Su Swagatam

The Rose flower is for someone special
Please don't touch it.



If u want
S----->Smiling
M----> Magnificient
A---->Awesome
R----> Refreshing
T---->Technical

STUFF

Then U R AT THE RIGHT PLACE


Tuesday, March 8, 2011

C ++ Paper

The Cradle of Bytes
C++ Objective Paper
Participant Name:-
College:-
Mobile No:-
1-void main () {
int x=10;
int &y=x;
y=20;
cout << x ; cout<a. 1010 b. 2020 c. 1020 d. 2010
2-11 ^ 5
What does the operation shown above produce?
a. 1 b. error c. 5th power of 11 d. 14
3-What do we mean by containership ?
a. a class can contain object of other classes b. a class can be defined inside another class c. a class can be inherited by many other classes d. None
4-What is the output?
class LD {
int i; }
class CE : public LD {
int j; }
void main() {
CE ce;
ce.i=10; ce.j=20 ;
cout << ce.i; cout <a. 1020 b. 2010 c. compile error d. None
5-. In protected derivation of a class
a. public becomes protected b. private becomes protected c. protected becomes protected d. both a and c
6- void main(){
static int i;
switch(i) {
default:cout<<"garbage";
case 0: cout<<"zero"; break;
case 1:cout<<"one"; break;
case 2: cout<<"two"; break; } }
a. error b. zero c. garbage zero d. zero garbage
7-What is output ?
void main(){
cout<<(-1<<4); }
a. ff00 b. ffff c. 240 d. None
8 -.What is the output ?
#define square(x) x*x
void main(){
int i; i = 64/square(4); cout << i; }
a. 16 b. 64 c. 4 d. error
9-What is the output?
main(){
cout<< main}
a. some address b. undefined symbol error c. 0xfa d. None
10-#define int char
main(){
int i=65 ; j=sizeof(i);
cout<a. error b. 1 c. 2 d. 0
11-int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What value does testarray[2][1][0] in the sample code above contain?
a. 3 b. 5 c. 7 d. 11
12-What is a difference between a declaration and a definition of a variable?
a. Both can occur multiple times, but a declaration must occur first.
b. A definition occurs once, but a declaration may occur many times.
c. A declaration occurs once, but a definition may occur many times.
d. Both can occur multiple times, but a definition must occur first.
13-What is the output ?
void main() {
int x, y=10 , z=10;
x=(y==z);
cout << x; }
a. 0 b. 1 c. error d. 10
14-Consider following code
class person { };
class Student : protected person { } ;
What happens in above code ?
a. will not compile because class body of person is not defined. b. will not compile becauses class body of student is not defined .c. will not compile because class person is not public inherited. d. will compile successfully.
15-.which of the following is not overloading the function?
int sum(int x,int y)
a. int sum(int x,int y,int z) b. float sum(int x, int y) c. int sum(float x, float y) d. float sum( int x, int y , float z)
16.which of the following functions give the current size of string object?
a. max_size() b. capacity() c. size() d. find()
17.We can make a class abstract by
a. using static key word b. using virtual keyword c. making at least one member function as virtual function d. making at least one member function as pure virtual function
18.Which of the following will produce a value of -22 if x=-22.9?
a. ceil() b. ceiling() c. floor() d. flooring()
19.What is result of the expression
(1 & 2) + ( 3 | 4) in base two?
a. 7 b. 110 c. 111 d. 101
20-.The actual source code for implementing a template function is created when
a. The function is actually created b. The declaration of the function appears
c. The definition of function appears d. The function is invoked
21.Which of the following is a sequence container?
a. stack b. deque c. queue d. set
22-.What is the error in the following code?
Class test {
Virtual void display();}
a.no error b. function display() should be declared static c. function display should be defined d. Test class should contain data members
23-. The friend functions are used in situations where
a. we want to exchange data between classes b. we want to have access to unrelated classes c. dynamic binding is required d. none
24.which of following are legal declarations of a reference?
a. int &a=10 b. int &a=m c. int &a=m++ d. all of these
25.which of the following cannot be passed to a function?
a. aliases b. header files c. both a and b d. none

c++ key
1-b

2-d

3-a

4-c// i is private member of class LD . so it cant be inherited

5-d

6-b// static variables r automatically asssigned 0 value

7-d

8-b// precedence of / is more tham that of * 64/4*4=16*4=64

9-a// functions also have address as variables

1o-b

11-d

12-c

13-b

14-d

15-b

16-c

17-d

18-a

19-c

20-d

21-b

22-a

23-b

24-b

25-b

No comments:

Post a Comment