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

Posted Date:-2022-07-05 04:35:51


Question:
 Return type of uncaught_exception () is ________________.

1.int

2.bool

3.char *

4.double

Posted Date:-2022-07-05 04:28:04


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

Posted Date:-2022-07-05 04:31:33


Question:
 What do container adapter provide to interface?

1. Restricted interface

2.More interface

3.No interface

4.None of these

Posted Date:-2022-07-05 04:47:45


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

Posted Date:-2022-07-05 06:01:53


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

Posted Date:-2022-07-05 05:57:56


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

Posted Date:-2022-07-05 04:24:19


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

1. A. ->*

2. .*

3.::*

4.both A and B

Posted Date:-2022-07-04 13:34:53


Question:
 Which operation is used as Logical 'AND'

1.Operator-&

2.Operator-

3.Operator-&&

4.Operator +

Posted Date:-2022-07-05 04:37:13


Question:
 Which operators is part of RTTI?

1.dynamic_cast()

2.typeid

3.Both dynamic_cast() & typeid

4.None of These

Posted Date:-2022-07-05 05:41:08


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

Posted Date:-2022-07-04 13:43:26


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

Posted Date:-2022-07-05 05:45:24


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()

Posted Date:-2022-07-05 04:30:29


Question:
Choose the operator which cannot be overloaded.

1. /

2.( )

3.::

4.%

Posted Date:-2022-07-04 13:25:53


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

Posted Date:-2022-07-05 04:23:13


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

1.Iterator

2.Indirect

3.Both Iterator & Indirect

4.None of the mentioned

Posted Date:-2022-07-05 04:45:35


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

Posted Date:-2022-07-05 04:29:13


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

Posted Date:-2022-07-05 05:59:41


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

Posted Date:-2022-07-05 04:46:58


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

Posted Date:-2022-07-04 13:28:59


Question:
Pick the odd one out

1.array type

2.character type

3.Boolean type

4.integer type

Posted Date:-2022-07-04 13:16:24


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

Posted Date:-2022-07-05 05:48:20


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

1.Actual parameter

2.Declared parameter

3.Passed parameter

4.None

Posted Date:-2022-07-05 04:38:49


Question:
What does an escape code represent?

1.alert

2.backslash

3.tab

4.form feed

Posted Date:-2022-07-04 13:17:56


Question:
What does the sequence adaptor provide?

1.Insertion

2.Deletion

3.Interface to sequence container

4.None of These

Posted Date:-2022-07-05 04:48:34


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

1.string_cmp()

2.strcmp()

3.equals()

4.str_compare()

Posted Date:-2022-07-04 13:32:19


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

Posted Date:-2022-07-05 04:39:44


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

Posted Date:-2022-07-05 04:44:11


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

Posted Date:-2022-07-04 13:23:52


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

1.Overloading

2.Overriding

3.Rewriting

4.All of these

Posted Date:-2022-07-05 04:32:38


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

Posted Date:-2022-07-05 04:38:01


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

Posted Date:-2022-07-05 06:00:57


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

1. const

2.volatile

3.const or volatile

4.int

Posted Date:-2022-07-05 05:55:46


Question:
Which container provides random access iterators?

1.vector

2.deque

3.sort

4.both vector & deque

Posted Date:-2022-07-05 06:03:08


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

1. int

2.short

3.void

4.float

Posted Date:-2022-07-04 13:17:06


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

1. seekg

2.seekp

3.both seekg & seekp

4.None

Posted Date:-2022-07-05 05:46:10


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

Posted Date:-2022-07-05 04:44:52


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

Posted Date:-2022-07-04 13:33:39


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.

Posted Date:-2022-07-04 13:15:32


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

Posted Date:-2022-07-04 13:14:21


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

1.enumeration

2.classes

3.both enumeration and classes

4.int

Posted Date:-2022-07-04 13:21:03


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

Posted Date:-2022-07-04 13:22:49


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

Posted Date:-2022-07-05 04:42:59


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

1. _

2. _ _

3.++ (postfix version)

4.=

Posted Date:-2022-07-04 13:26:45


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

Posted Date:-2022-07-04 13:19:29


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

Posted Date:-2022-07-04 13:30:32


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

1.Zero

2.One

3.Two

4.Three

Posted Date:-2022-07-05 04:34:13


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!