Cpp Quiz interview questions – page 2
118 questions. Tap “Show answer” to check yourself.
-
A virtual base class is useful when
- It makes sense to use a base class is ambiguous
- Identification of a function in a base class is ambiguous
- There are multiple paths from one derived class to another
- Different functions in base and derived classes have the same name
Show answer
B. Identification of a function in a base class is ambiguous
-
The keyword void is used to declare
- Objects that can be modified outside of program control
- A synonym for an existing type
- A member function that is defined in a subclass
- Absence of a type
Show answer
C. A member function that is defined in a subclass
-
Virtual functions allow to
- Use same function call to execute member functions of objects from different classes
- Group objects of different classes so they can all be accessed by the same function code
- Create functions that have no body
- Create an array of type pointer to base calls that can hold pointers to derived classes
Show answer
A. Use same function call to execute member functions of objects from different classes
-
Redirection redirects
- Screen from a device to a stream
- A device from the screen to a file
- A stream from a file to the screen
- A file from a device to a stream
Show answer
C. A stream from a file to the screen
-
Memorizing the new items used in C++ is
- Critically important
- Completely irrelevant
- The key to wealth and success
- Something you can return to later
Show answer
D. Something you can return to later
-
The scope resolution operator usually
- Providing a useful conceptual frame work
- Specifies a particular class
- Tells what base class is derived from
- Limits the visibility of variables to a certain function
Show answer
B. Specifies a particular class
-
An enumerated data type brings together a group of
- Constant values, integers with user defined names
- Related data type
- Items of different data type
- All of these
Show answer
A. Constant values, integers with user defined names
-
A variable defined within a block is visible
- From the point of definition onward in the block
- From the point of definition on ward in the function
- From the point of definition on ward in the program
- Throughout the function
Show answer
A. From the point of definition onward in the block
-
The library function exit( ) causes an exit from
- The program in which it occurs
- The function in which it occurs
- The block in which it occurs
- The loop in which it occurs
Show answer
A. The program in which it occurs
-
The names beginning with an underscore are reserved for _____ variable.
- Globar
- Local
- Internal system
- External system
Show answer
C. Internal system
-
____ literals are treated as array of characters.
- Graphic
- Character
- String
- Non-graphic
Show answer
C. String
-
Which one holds the values or constants in memory boxes?
- Variable
- While
- Goto
- Switch
Show answer
A. Variable
- Advertisement
-
In which type of constant the Decimal numbers, integer and floating-point are related?
- Numeric
- String
- Char
- Boolean
Show answer
A. Numeric
-
The basic types are collectively called as ___
- Looping
- Tokens
- Expression
- Variables
Show answer
B. Tokens
-
____ are data items whose value cannot be changed.
- Class
- Return
- Constants
- Variable
Show answer
C. Constants
-
Which punctuator is used to group a set of C++ statements?
- {}
- []
- ()
- /
Show answer
A. {}
-
____ refers to the process of changing the data type of the value stored in a variable.
- Type char
- Type int
- Type float
- Type cast
Show answer
D. Type cast
-
____ data types are structure, union, class and enumeration.
- Derived
- Integer
- Built-in
- User defined
Show answer
D. User defined
-
Which operator is used to compare numerical values?
- Relational
- Conditional
- Assignment
- Arithmetic
Show answer
A. Relational
-
____ allocates memory, based on the data type of the variable.
- Interpreter
- Link
- Converter
- Compiler
Show answer
D. Compiler
-
Every variable will be referred by its ___
- Data
- Int
- Name
- Address
Show answer
D. Address
-
Which storage class defines local variable known to the block in which they are defined?
- Register
- Auto
- Extern
- Static
Show answer
B. Auto
-
____ allows users to define the user defined data type identifier.
- Class
- Data
- Identifier
- Type definition
Show answer
D. Type definition
-
What is the length of long double data type?
- 8
- 16
- 32
- 80
Show answer
D. 80
- Advertisement
-
When a=6 and c=a++ what is the value of c?
- 6
- 7
- 8
- 9
Show answer
A. 6
-
The statement int A; b; is invalid because ____
- Variables should be separated by Comma
- Capital A is not allowed
- Only one variable should be given
- All of these
Show answer
A. Variables should be separated by Comma
-
What is the default file extension for all Word documents?
- FIL
- DOC
- WRD
- TXT
Show answer
B. DOC
-
The ____ key and the ___ key can be used in combination with other keys to perform shortcuts and special tasks.
- Control, Alt
- Function, toggle
- Delete, Insert
- Caps Lock, Num Lock
Show answer
A. Control, Alt
-
How many operators are classified in C++?
- 11
- 13
- 14
- 15
Show answer
B. 13
-
____ is the C increment Operator in C++.
- ++
- +*
- *+
- --
Show answer
A. ++