C++ Fundamentals

Multiple choice questions testing core C++ programming concepts including pointers, arrays, constructors, operators, inheritance, streams, and exception handling.

25 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

A pointer is

  1. the address of a variable
  2. the data type of an address variable
  3. a variable for storing address
  4. an indication of variable to be accessed next
Question 2 Multiple Choice (Single Answer)

An array element is accessed by using

  1. the dot operator
  2. a member name
  3. an index number
  4. a FIFO method
Question 3 Multiple Choice (Single Answer)

A variable defined within a block is visible

  1. from the point of definition onward in the program
  2. throughout the function
  3. from the point of definition onward in the function
  4. from the point of definition onward in the block
Question 4 Multiple Choice (Single Answer)

A copy constructor is invoked when

  1. a function returns by value
  2. an argument is passed by value
  3. a function calls to another function
  4. an argument is passed by reference
Question 5 Multiple Choice (Single Answer)

Overloaded functions

  1. are a group of functions with the same name
  2. make life harder for programmers
  3. may fail unexpectedly due to over stress
  4. all have same number and type of arguments
Question 6 Multiple Choice (Single Answer)

The new operator

  1. returns a pointer to a variable
  2. creates a variable called new variable
  3. clears memory for a new variable
  4. tells how much memory is available
Question 7 Multiple Choice (Single Answer)

The break statement causes an exit

  1. only from the innermost loop
  2. only from the innermost switch
  3. from the innermost loop or switch
  4. from all loops or switches
Question 8 Multiple Choice (Single Answer)

A relational operator

  1. assigns one operand to another
  2. compares two operands
  3. logically combines two operands
  4. gets a numeric result
Question 9 Multiple Choice (Single Answer)

Inheritance is a way to

  1. make general classes into more specific classes
  2. pass arguments to objects of classes
  3. add features to existing classes by rewriting them
  4. improves data hiding and encapsulation
Question 10 Multiple Choice (Single Answer)

A function contained within a class is called

  1. a class
  2. an operator
  3. a data item
  4. a member function
Question 11 Multiple Choice (Single Answer)

The first element of the string is

  1. the name of string
  2. the first character in the string
  3. the length of string
  4. the name of array holding the string
Question 12 Multiple Choice (Single Answer)

When a multi-dimensional array is accessed, each array index is

  1. separated by commas
  2. surrounded by brackets and separated by commas
  3. surrounded by brackets
  4. separated by commas and surrounded by brackets
Question 13 Multiple Choice (Single Answer)

The scope resolution operator

  1. resolved ambiguity by specifying a particular class
  2. limits the visibility of variables
  3. informs which base class is derived
  4. ensures copying data types
Question 14 Multiple Choice (Single Answer)

The errors which are caused by events beyond the control of program are called

  1. synchronous exceptions
  2. asynchronous exceptions
  3. all of above
  4. none of these
Question 15 Multiple Choice (Single Answer)

Manipulators are used to

  1. allocate memory
  2. free allocated memory
  3. resolve scope of variable
  4. formats data display
Question 16 Multiple Choice (Single Answer)

Which of the following is enclosed in double quotation marks?

  1. Integer constant
  2. Floating Constant
  3. Character Constant
  4. String Constant
Question 17 Multiple Choice (Single Answer)

The keyword void is used to

  1. declare a member function that is defined in a subclass
  2. designate the absence of a type
  3. declare objects that can be modified outside of program control
  4. declare a synonym for an existing type
Question 18 Multiple Choice (Single Answer)

The exception is activated through which keyword?

  1. Try
  2. Catch
  3. Struct
  4. Throw
Question 19 Multiple Choice (Single Answer)

The identifiers which can not be used as names of variables or other user defined elements are called

  1. keywords
  2. constants
  3. tokens
  4. operators
Question 20 Multiple Choice (Single Answer)

The GOTO statement causes the control to go to

  1. an operator
  2. a label
  3. a function
  4. a variable
Question 21 Multiple Choice (Single Answer)

A friend function is used to

  1. avoid arguments between classes
  2. allow access to classes whose source code is unavailable
  3. allow one class to access an unrelated class
  4. increase the versatility of an member function
Question 22 Multiple Choice (Single Answer)

In a linked list

  1. each link contains a pointer to the next link
  2. an array of pointers points to the link
  3. no link contains data
  4. the links are stored in an array
Question 23 Multiple Choice (Single Answer)

A C++ stream is

  1. the flow of control through a function
  2. a flow of data from one place to another
  3. not related to a class
  4. takes no arguments
Question 24 Multiple Choice (Single Answer)

Which operator is used to denote 'not equal to'?

  1. <>
  2. ##
  3. !=
  4. :=
Question 25 Multiple Choice (Single Answer)

When a language has the capability to produce new data type, its called

  1. reproductive
  2. encapsulated
  3. extensible
  4. none of above