C++ Fundamentals

C++ Fundamentals and Object-Oriented Programming concepts including classes, objects, constructors, destructors, inheritance, operators, and stream I/O

25 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

A static member function can change

  1. any member of the class instances
  2. only static members of class instances
  3. only integer values
  4. none of the above
Question 2 Multiple Choice (Single Answer)

Destructor function is called when the object

  1. goes out of scope
  2. expires
  3. both (1) and (2)
  4. none of the above
Question 3 Multiple Choice (Single Answer)

Which of the following operators can be overloaded in C++?

  1. +=
  2. =
  3. = =
  4. All of the above
Question 4 Multiple Choice (Single Answer)

Default constructor has

  1. no arguments
  2. one argument
  3. two arguments
  4. an object argument
Question 5 Multiple Choice (Single Answer)

For class person, destructor would be

  1. `Person
  2. ~Person
  3. :Person
  4. None of the above
Question 6 Multiple Choice (Single Answer)

How many types of constructors are possible in C++?

  1. 1
  2. 2
  3. 3
  4. 4
Question 7 Multiple Choice (Single Answer)

'ostream.put method' is used to write

  1. a string
  2. a char
  3. an int
  4. all of the above
Question 8 Multiple Choice (Single Answer)

How many objects of a class can be instantiated?

  1. 1
  2. 5
  3. 99
  4. No limit
Question 9 Multiple Choice (Single Answer)

>> is also called

  1. extraction operator
  2. insertion operator
  3. unary Operator
  4. binary operator
Question 10 Multiple Choice (Single Answer)

Structure in C++ can store

  1. only similar data type
  2. any data type
  3. only two data types
  4. only 5 data types
Question 11 Multiple Choice (Single Answer)

To set the precision of floating point number, you use

  1. Cout.prec()
  2. Cout.precision
  3. Cout.Precision
  4. None of the above
Question 12 Multiple Choice (Single Answer)

Inheritance is used to

  1. reuse code
  2. add functionality
  3. both (1) and (2)
  4. none of the above
Question 13 Multiple Choice (Single Answer)

Class Libraries can be used

  1. to reuse code
  2. for component based programming
  3. both (1) and (2)
  4. none of the above
Question 14 Multiple Choice (Single Answer)

Class is best described as

  1. a user defined data type
  2. a data type
  3. a template for objects
  4. all of the above
Question 15 Multiple Choice (Single Answer)

Objects are used to

  1. mimic real life cases
  2. wake at abstract level
  3. both (1) and (2)
  4. none of the above
Question 16 Multiple Choice (Single Answer)

C++ language is a/an

  1. object oriented language
  2. structured language
  3. procedural language
  4. none of the above
Question 17 Multiple Choice (Single Answer)

Private data can be inherited.

  1. True
  2. False
  3. Sometimes true
  4. None of the above
Question 18 Multiple Choice (Single Answer)

Methods are generally

  1. private
  2. public
  3. protected
  4. none of the above
Question 19 Multiple Choice (Single Answer)

Class definition is terminated by

  1. @
  2. !
  3. :
  4. ;
Question 20 Multiple Choice (Single Answer)

In C,

  1. data is secure
  2. data is insecure
  3. data is abstract
  4. none of the above
Question 21 Multiple Choice (Single Answer)

In C++,

  1. data is secure
  2. data is insecure
  3. data is abstract
  4. none of the above
Question 22 Multiple Choice (Single Answer)

The entry point of C++ program is

  1. the first line of the class
  2. the main function
  3. the first executable method of the class
  4. none of the above
Question 23 Multiple Choice (Single Answer)

Which of the following is not a C++ keyword?

  1. asm
  2. signed
  3. export
  4. inline
Question 24 Multiple Choice (Single Answer)

In argument passing by value,

  1. same variable is accessed in called function
  2. new variable is accessed in called function
  3. new object is created in memory
  4. both (2) and (3)
Question 25 Multiple Choice (Single Answer)

Which of the following is not a C++ keyword?

  1. _cs
  2. _ss
  3. _ds
  4. _cc