1.What will be the results of “54 << 3"?

  • None of these
  • I don’t know
  • 623
  • 556
  • 523
  • 47
  • 440
  • 432
  • 413

2.Which one is correct, according to the ANSI specifications?

  • void main(void)
  • void main()
  • int main()
  • I don’t know

3.The fundamental storage unit in the C + + memory model is?

  • int
  • I don’t know
  • double
  • char
  • byte
  • bit

4.Which of the following is not a keyword?

  • volatile
  • union
  • typeid
  • try
  • None
  • mutable
  • I don’t know
  • dynamic_cast
  • cast

5.What is this- “extern int a;” ?

  • I don’t know
  • Definition
  • Declaration

6.What is this - “int f(int x) { return x+10; }” ?

  • I don’t know
  • Definition
  • Declaration

7.What is this - “int f(int x);” ?

  • I don’t know
  • Definition
  • Declaration

8.Can namespaces be nested?

  • Yes
  • No
  • I don’t know
  • Depends

9.May destructors have arguments?

  • Yes
  • No
  • I don’t know

10.Where can you put a continue statement?

  • Inside a function
  • In or as a loop body
  • In a nested loop
  • I don’t know
  • Everywhere in the program
  • Elsewhere

11.Can a return statement be used into a void function?

  • Yes, and nothing will happen
  • Yes, and it will exit the function
  • Yes, and it will be ignored
  • No
  • I don’t know
  • Depends

12.Can a static member function be virtual?

  • Yes
  • No
  • I don’t know
  • Depends

13.Can unions have constructors and destructors?

  • Yes
  • No
  • I don’t know

14.Can unions have virtual functions?

  • Yes
  • No
  • I don’t know

15.Can the anonymous unions have private and protected members?

  • Yes
  • No
  • I don’t know

16.Can the anonymous unions have function members?

  • Yes
  • No
  • I don’t know

17.Can a bit-field be a static member?

  • Yes
  • No
  • I don’t know

19.Can classes be nested?

  • Yes
  • No
  • I don’t know
  • Depends

20.Can a friend template be defined within a class?

  • Yes
  • No
  • I don’t know

21.What a function cannot return?

  • Reference
  • Pointer
  • None of them
  • I don’t know
  • Array
  • All of them

22.Is it possible to get the address of a constructor?

  • Yes
  • No
  • I don’t know
  • Depends

23.If we have class A with variable Name in it and write: “A *obj”, how do you invoke the Name variable?

  • obj.Name
  • obj->Name
  • None of these will work
  • I don’t know
  • c and d will work
  • All of these will work
  • A.Name
  • A->Name
  • a and b will work

24.Can you overload the constructor?

  • Yes
  • No
  • I don’t know

25.Where can you overload the “=” operator?

  • It can’t be overloaded
  • In an operator-member function
  • In a friend function
  • I don’t know
  • Both b and c are true

26.What type is the [] operator, when talking about overloading it?

  • Unary
  • Not-defined
  • I don’t know
  • Binary

27.Which of these has the lowest precedence priority?

  • ||
  • |
  • ^
  • I don’t know
  • ?:
  • >>
  • <<
  • &&
  • &

28.What will be the result of 100/10*2?

  • Other
  • I don’t know
  • 5
  • 20

29.What will be the results of 1000/100%7*2?

  • Other
  • I don’t know
  • 6
  • 250
  • 1000
  • 10

30.What will this do: for(;;)?

  • Loop forever
  • Illegal
  • Ignored by the compiler
  • I don’t know
  • Crash the OS

31.Which of the following is evaluated first?

  • ||
  • I don’t know
  • &&
  • !

Tags: ,

6 Responses to “C++ Test 2”

  1. dhivvya says:

    Very nice and thanks a lot to share this with us.

  2. dhivvya says:

    Nice standard questions. If we get the answers, it will be fantastic.

  3. czarny_3 says:

    why i can’t chose any answers? shoul i write it on sheet of paper? but how can i check my answers?

  4. wdy says:

    i know some of them,not all of them,but i cann’t get the right answer.

  5. gowtham says:

    Very nice and very important questions in programing language thanks

  6. zbdot73 says:

    These are great introductory questions…
    Is it possible to get a list of correct answers?

Leave a Reply

You must be logged in to post a comment.