C Ques
C Ques
cout<<sizeof(float);
a) 4.000000
b) 2
c) 4
d) 8
#include<iostream.h>
void x(int a,int &b)
{
a=a+b;
a=a-b;
b=b-a;
}
void main()
{
int a=4,b=10;
x(a,b);
cout<<a<<b;
}
a) 4,10
b) 10,4
c) 4,4
d) 4,6
int a=0;
for(int I=1;I<=a;I++)
cout<<I;
a) 0
b) 1
c) Nothing will get displayed
d) Error
11) Which one of the following is a valid method for accessing the 3rd element
of the array cust?
a) cust.3
b) cust[3]
c) cust[2]
d) cust(2)
13)If p & q are int type variables, what will be the result of the expression
p%q
Where p=-16 and q=-3
a) 1
b) -1
c) 5
d) -5
17)Which manipulator is used to specify the required field size for displaying
an output value?
a) setfill()
b) setprecision()
c) setw()
d) setiosflags()
22)A datatype that allows different data types to be assigned to the same
storage location is called_________
a) Enum
b) Union
c) Array
d) None of the above
23)What is the value of a & b after the following two statements are
executed?
int a=10;
int b=a++ * ++a;
a) 132
b) 110
c) 120
d) None of the above
24)The following examples show that the class R id derived from classes P
and Q. Which of them are legal?
a) class R:public P: public Q
b) class R:public P,Q
c) class R:public P, public Q
d) class R::public P: public Q
ANSWERS
1. (d) None
2. (a) True
3. (c) Default constructor
4. (b) \0 null
5. (a) has no body
6. (a) Friend
7. (c) 4
8. (d) 4,6
9. (b) ~
10.(c) Nothing will get displayed
11.(c) cust[2]
12.(a) Yes
13.(b) –1
14.(c) ios::trunc
15.(a) template
16.(b) Class name
17.(c) setw()
18.(b) Address of another variable
19.(b) No
20.(d) Encapsulation
21.(b) False
22.(b) Union
23.(c) 120
24.(c) class R:public P, public Q
25.(a) int sum(int x,int y,int z) {}