C++ Fundamentals
Multiple choice questions testing core C++ programming concepts including pointers, arrays, constructors, operators, inheritance, streams, and exception handling.
Questions
A pointer is
- the address of a variable
- the data type of an address variable
- a variable for storing address
- an indication of variable to be accessed next
An array element is accessed by using
- the dot operator
- a member name
- an index number
- a FIFO method
A variable defined within a block is visible
- from the point of definition onward in the program
- throughout the function
- from the point of definition onward in the function
- from the point of definition onward in the block
A copy constructor is invoked when
- a function returns by value
- an argument is passed by value
- a function calls to another function
- an argument is passed by reference
Overloaded functions
- are a group of functions with the same name
- make life harder for programmers
- may fail unexpectedly due to over stress
- all have same number and type of arguments
The new operator
- returns a pointer to a variable
- creates a variable called new variable
- clears memory for a new variable
- tells how much memory is available
The break statement causes an exit
- only from the innermost loop
- only from the innermost switch
- from the innermost loop or switch
- from all loops or switches
A relational operator
- assigns one operand to another
- compares two operands
- logically combines two operands
- gets a numeric result
Inheritance is a way to
- make general classes into more specific classes
- pass arguments to objects of classes
- add features to existing classes by rewriting them
- improves data hiding and encapsulation
A function contained within a class is called
- a class
- an operator
- a data item
- a member function
The first element of the string is
- the name of string
- the first character in the string
- the length of string
- the name of array holding the string
When a multi-dimensional array is accessed, each array index is
- separated by commas
- surrounded by brackets and separated by commas
- surrounded by brackets
- separated by commas and surrounded by brackets
The scope resolution operator
- resolved ambiguity by specifying a particular class
- limits the visibility of variables
- informs which base class is derived
- ensures copying data types
The errors which are caused by events beyond the control of program are called
- synchronous exceptions
- asynchronous exceptions
- all of above
- none of these
Manipulators are used to
- allocate memory
- free allocated memory
- resolve scope of variable
- formats data display
Which of the following is enclosed in double quotation marks?
- Integer constant
- Floating Constant
- Character Constant
- String Constant
The keyword void is used to
- declare a member function that is defined in a subclass
- designate the absence of a type
- declare objects that can be modified outside of program control
- declare a synonym for an existing type
The exception is activated through which keyword?
- Try
- Catch
- Struct
- Throw
The identifiers which can not be used as names of variables or other user defined elements are called
- keywords
- constants
- tokens
- operators
The GOTO statement causes the control to go to
- an operator
- a label
- a function
- a variable
A friend function is used to
- avoid arguments between classes
- allow access to classes whose source code is unavailable
- allow one class to access an unrelated class
- increase the versatility of an member function
In a linked list
- each link contains a pointer to the next link
- an array of pointers points to the link
- no link contains data
- the links are stored in an array
A C++ stream is
- the flow of control through a function
- a flow of data from one place to another
- not related to a class
- takes no arguments
Which operator is used to denote 'not equal to'?
- <>
- ##
- !=
- :=
When a language has the capability to produce new data type, its called
- reproductive
- encapsulated
- extensible
- none of above