CLASS XI - CBSE - UNIT TEST-2 : COMPUTER SCIENCE SAMPLE TEST PAPER
1)
If a = 50 and
b=4, then determine the result of the following.
(i) a+=b; (ii) a%=b; (iii) a – =b; (iv) a*=b;
2)
Assume that x, y
and z, all are int variables equals to 50, 20 and 6 respectively.
What will be the result of x/y/z? Analyze the same and choose the correct option?
What will be the result of x/y/z? Analyze the same and choose the correct option?
(a) 0 (b)
12 (c) 16
(d) A system error as this is syntactically invalid.
(e) A runtime error because this is a division by 0.
3)
Construct the
logical expressions to represent the following conditions:
(i) Age
is greater than or Equal to 18 but less then 30. (ii) a
is odd.
(iii) Fees
range 10000-15000 or student is 1. (iv)
n is positive number
4)
Write the
corresponding C++ expression for the following mathematical expression:
(i) a+b-c*d/e%h (ii)
x+y / (t + u)3
5)
Match the
following operators:
A B
(i) ! : (a) Equal
to Operator
(ii) | |` : (b) Assignment
Operator
(iii) ! = : (c) Logical
OR Operator
(iv) = = : (d) Logical
Negation Operator
: (e) Not
Equal To Operator
6)
Find out errors
if any in the following C++ statements and rewrite the correct statements.
(i) cout << “ x = “ x ; (ii) cin >> i ;
>> j ;
7)
What will be the
output of the given following code fragment:
int ch = 20;
cout << ++ch << ”\n” << ch
<<”\n”;
8)
Find out the
results of the following:
(a) Two expressions, if i=30 initially?
(i)
++i <= 30; (ii) i++ <= 30;
(b) What will be the result of following expressions, if :
(i)
age = 25 (ii)
age = 65 (iii) age=85;
cout<<
age > 65 ? 350 : 100 ;
(c) What will be the result of the following expressions?
(i)
(15 > 13) && (16 <= 16) || (15
!= 16) ; (ii) (15 < 13) && ((16 <= 16)
|| (15 != 16)) ;
(iii) !(15 < 13) && ((16 <= 16)
|| (15 != 16)) ;
9)
Write the
programs (Any three):
(i)
to find the area
of circle.
(ii)
to input a
number. If the number is even, print its square otherwise print its cube.
(iii)
which will raise
any number X to a positive power n, obtain values of X and
n from the user.
(iv)
to input a
character and check the character is vowel or not.
* * * * *
No comments
Post your comments