Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Ist Term Examination Class XI (2010-2011) Computer Science Duration: 3 Hrs.

Note: 1. All questions are compulsory. 2. Programming Language: C++ Section A : 1. What are literals in C++ ? 2. What is the function of type conversion? 3. What is the significance of NULL (\0) character in a string ? 4. Suppose value in an identifier of int type having value 25. After the statement float chks = value ; what does the variable chks store? 5. Define conditional operator used in C++. . Section B: 1. What are the differences between break and continue statements? 2. What will be the output of the following program segment? #include<iostream.h> void main () { int x; x=5; cout<<x++; cout<<x; cout<<++x; } 3. Differentiate between switch and if-else statement used in C++. 4. Correct the following code so that it is functional : #include<iostream.h> void main() { value=4; do; { total +=value; cout<<total; while value <= 8; } } 5. What is a variable? How many values are associated with it? 6. What is an input operator >> and output operator << called ? [6*3] [5*1]

Max marks: 70

Section C 1. Write a for loop which will produce the following output(hint: use two nested for loops) 1 22 333 4444 55555 2. Rewrite the following set of if-else statement in terms of switch-case statement. #include<iostream.h> void main() { int num,val; cin>>num; if (num==5) { val=num*25-20; cout<<num+val; } else { if(num==10) { val=num*20-15; cout<<val-num; } } } 3. What will be the output of the following: #include<iostream.h> void main() { int I=0,X=0; do { if( I % 5 ==0) { X++; cout<<X; } ++I; }while (I<20); cout<<\n<<X; }

[8*4]

4. What is the function of Logical Operators.Write an expression involving a logical operator to test if marks are 55 and grade is B. 5. Write a C++ Program that accepts a Character between a to j and prints next 4 characters. 6. Why is function main( ) special ? What would happen if main ( ) is not present in the program? 7. What is the difference between Unary and Binary operators? Give their examples. 8. Write a program which computes the Factorial of a given positive integer number. Section D: [3*5]

1. Write a program to input the code of a particular item, the quantity purchased and the rate .Then ask if any more items to be purchased .If not then calculate the total purchase and print it along with the gift to be presented. The gifts to the customer are given in the following manner : Amount of Purchase (Rs.) 100 and above but less than 500 500 and above but less than 1000 1000 and above Gift A key ring A leather purse A pocket calculator

2. What is Iteration? How many kinds of loops are provided y C++? Explain any one of them with the help of an example. 3. Write a program to check whether the number inputted is prime or not.

You might also like