C/C /CPP Programming MCQ Set 2 Sample Test,Sample questions

Question:
 For automatic objects, constructors and destructors are called each time the objects

1.enter and leave scope

2.inherit parent class

3.are constructed

4.are destroyed


Question:
 Return type of uncaught_exception () is ________________.

1.int

2.bool

3.char *

4.double


Question:
 The code of statements which may cause abnormal termination of the program should bewritten under_________ block.

1.Try

2.catch

3.Finally

4.None of these


Question:
 What do container adapter provide to interface?

1. Restricted interface

2.More interface

3.No interface

4.None of these


Question:
 Which among the following is a mandatory condition for downcasting?

1. It must not be done explicitly

2. It must be done implicitly

3.It must be done explicitly

4.It can’t be done explicitly


Question:
 Which is the pointer which denotes the object calling the member function?

1. Variable pointer

2.This pointer

3.Null pointer

4.Zero pointer


Question:
 Which of the following best defines the syntax for template function?

1.Template

2.Template return_type Function_Name(Parameters)

3.Both a and b

4.None of These


Question:
 Which of the followings is/are pointer-to-member declarator?

1. A. ->*

2. .*

3.::*

4.both A and B


Question:
 Which operation is used as Logical 'AND'

1.Operator-&

2.Operator-

3.Operator-&&

4.Operator +


Question:
 Which operators is part of RTTI?

1.dynamic_cast()

2.typeid

3.Both dynamic_cast() & typeid

4.None of These


Question:
Assigning one or more function body to the same name is called ____________.

1.Function Overriding

2.Function Overloading

3.Both A and B

4. None of the above


Question:
At which time does the static_cast can be applied?

1.Compile-time construct

2.Runtime construct

3.Both Compile-time & Runtime construct

4.None of These


Question:
Attempting to throw an exception that is not supported by a function call results in calling _____________ library function.

1.indeterminate ()

2.unutilized()

3.unexpected()

4. unpredicted()


Question:
Choose the operator which cannot be overloaded.

1. /

2.( )

3.::

4.%


Question:
Default values for a function are specified when ____.

1. Function is defined

2.Function is declared

3.Both a and b

4. None of these


Question:
How can the member functions in the container be accessed?

1.Iterator

2.Indirect

3.Both Iterator & Indirect

4.None of the mentioned


Question:
If inner catch handler is not able to handle the exception then__________.

1.Compiler will look for outer try handler

2. Program terminates abnormally

3.Compiler will check for appropriate catch handler of outer try block

4. None


Question:
If multiple inheritance is implemented, which upcasting will be correct?

1.Upcast to first base class listed in inheritance

2.Upcast to any base class

3. Upcast to send base class listed in inheritance

4.Upcast is not possible


Question:
In which type of storage location are the vector members stored?

1.Contiguous storage locations

2.Non-contiguous storage locations

3.Contiguous & Non-contiguous storage locations

4.None of the mentioned


Question:
lass function which is called automatically as soon as the object is created is called as __

1.Constructor

2.Destructor

3.Friend function

4. Inline function


Question:
Pick the odd one out

1.array type

2.character type

3.Boolean type

4.integer type


Question:
String class have a concat() function that is used to ______

1.Replace old string by new string

2.Add two strings

3.Append one string at end of another string

4.Remove a string from end of one string


Question:
Variable that are listed in function's calls are called

1.Actual parameter

2.Declared parameter

3.Passed parameter

4.None


Question:
What does an escape code represent?

1.alert

2.backslash

3.tab

4.form feed


Question:
What does the sequence adaptor provide?

1.Insertion

2.Deletion

3.Interface to sequence container

4.None of These


Question:
What is the built in library function to compare two strings?

1.string_cmp()

2.strcmp()

3.equals()

4.str_compare()


Question:
What kind of error can arise when there is a problem with memory?

1.Segmentation fault

2.Produce an error

3. Both Segmentation fault & Produce an error

4.None of the mentioned


Question:
What operation can be performed by destructor?

1.Abort the program

2.Resource cleanup

3.Exit from the current block

4.None of the mentioned


Question:
When a language has the capability to produce new data type mean, it can be called as …...

1.overloaded

2.extensible

3.encapsulated

4.reprehensible


Question:
When a virtual function is redefined by the derived class, it is called___________.

1.Overloading

2.Overriding

3.Rewriting

4.All of these


Question:
When an ADT is implemented as a C++ class, which of the following should normally betrue?

1.Member functions are private, member variables are public

2.Member functions are public, member variables are private

3.Member functions as well as member variables are private

4.Member functions as well as member variables are public


Question:
When are the pointer types known for upcasting the objects?

1. Compile time .

2.Runtime

3.Source code build time

4.Doesn’t apply to pointer types


Question:
Which among the following is/are type(s) of this pointer?

1. const

2.volatile

3.const or volatile

4.int


Question:
Which container provides random access iterators?

1.vector

2.deque

3.sort

4.both vector & deque


Question:
Which data type is used to represent the absence of parameters?

1. int

2.short

3.void

4.float


Question:
Which function is used to position back from the end of file object?

1. seekg

2.seekp

3.both seekg & seekp

4.None


Question:
Which interface in the container is required for storage management?

1. A. Memory management

2.Allocator interface

3.Memory interface

4.None of the mentioned


Question:
Which of the following are member dereferencing operators in CPP?1. * 2. :: 3. ->* 4. ::* 5. ->

1.Only 1, 3, 4

2.Only 1 and 5

3.Only 3 and 4

4.Only 3,4,5


Question:
Which of the following is incorrect in C++?
(1)When we write overloaded function we must code the function for each usage.
(2)When we write function template we code the function only once.
(3)It is difficult to debug macros
(4)Templates are more efficient than macros

1. (1) and (2)

2.(1), (2) and (3)

3.(3) and (4)

4.All are correct.


Question:
Which of the following is true about templates?
1) Template is a feature of C++ that allows us to write one code for different data types.
2) We can write one function that can be used for all data types including user defined types. Like sort(), max(), min(), ..etc.
3) We can write one class or struct that can be used for all data types including user defined types. Like Linked List, Stack, Queue,..etc.
4) Template is an example of compile time polymorphism.

1.1 and 2

2.1, 2 and 3

3.1, 2 and 4

4.1, 2, 3 and 4


Question:
Which of the following statements are true? int f (float)

1.enumeration

2.classes

3.both enumeration and classes

4.int


Question:
Which of the following statements are true? int f (float)

1. f is a function taking an argument of type int and returning a floating point number

2. f is a function taking an argument of type float and returning an integer

3. f is a function of type float

4.none of the mentioned


Question:
Which operations don’t throw anything?

1.Operations which are reversible

2.Operations which are irreversible

3.Operations which are static

4.Operations which are dynamic


Question:
Which operator is required to be overloaded as member function only?

1. _

2. _ _

3.++ (postfix version)

4.=


Question:
Which type is best suited to represent the logical values? all of the mentioned

1.integer

2.Boolean

3.character

4. all of the mentioned


Question:
Which type of data file is analogous to an audio cassette tape?

1. Random access file

2.Sequential access file

3.Binary file

4.Source code file


Question:
While overloading binary operators using member function, it requires ___ argument/s.

1.Zero

2.One

3.Two

4.Three


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
  24. C MCQS:-The ABC of C
  25. C MCQS Interview Questions
  26. C++ Questions and Answers OOPs Basic Concepts
  27. C++ Questions and Answers Returning Objects
  28. C Programming MCQ Part 1
  29. C Programming MCQ
  30. Computer Science & Engineering C Multiple Choice Questions set 1
  31. Computer Science & Engineering C Multiple Choice Questions set 2
  32. C Multiple Choice Questions C Functions Set 1
  33. C Multiple Choice Questions C Functions Set 2
  34. C Multiple Choice Questions C Operators
  35. C Multiple Choice Questions & AnswersConditional Expressions
  36. C Multiple Choice Questions & Answers Data Types
  37. C Multiple Choice Questions & Answers File Access
  38. Computer Science & Engineering Cloud Computing MCQs Part 1
  39. CPP Programming MCQ Set 1
  40. CPP Programming MCQ Set 2
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!