Tuesday, September 6, 2011

Test your C skills..........

19. If we have this code:

char arr[8]; 
cin >> arr;

And this text is entered: "Hello World", what there will be in "arr"?
a) Hello World
b) Hello Wo
c) Hello W
d) Hello
e) Other
f) I don't know


20. If we have this code:
class A { public:
   A() { cout << 1; }
   ~A() { cout << 2; }
};
class B : public A
{ public:
   B() { cout << 3; }
   ~B() { cout << 4; }
}; 
And we create an object from class B, what will be the result?
a) 3124
b) 3142
c) 3412
d) 1234
e) 1324
f) 1342
g) Other
h) I don't know


21. What will be the result of: cout << (5 << 3); ?a) Compiler error
b) 53
c) 40
d) 35
e) I don't know
22. What will be the result of: cout << 22/5*3; ?a) 13.2
b) 1.47
c) 12
d) 1
e) Other
f) I don't know


23. Which keyword specifies that an integer variable can not take negative values?a) positive
b) long
c) unsigned
d) Other
e) There is not such a keyword
f) I don't know


24. If we have: char a; , which one is incorrect?a) a = 3;
b) a = "3";
c) a = '3';
d) All are correct
e) I don't know

No comments:

Post a Comment