Cpp Quiz interview questions – page 2

118 questions. Tap “Show answer” to check yourself.

Advertisement
  1. A virtual base class is useful when

    1. It makes sense to use a base class is ambiguous
    2. Identification of a function in a base class is ambiguous
    3. There are multiple paths from one derived class to another
    4. Different functions in base and derived classes have the same name
    Show answer

    B. Identification of a function in a base class is ambiguous

  2. The keyword void is used to declare

    1. Objects that can be modified outside of program control
    2. A synonym for an existing type
    3. A member function that is defined in a subclass
    4. Absence of a type
    Show answer

    C. A member function that is defined in a subclass

  3. Virtual functions allow to

    1. Use same function call to execute member functions of objects from different classes
    2. Group objects of different classes so they can all be accessed by the same function code
    3. Create functions that have no body
    4. 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

  4. Redirection redirects

    1. Screen from a device to a stream
    2. A device from the screen to a file
    3. A stream from a file to the screen
    4. A file from a device to a stream
    Show answer

    C. A stream from a file to the screen

  5. Memorizing the new items used in C++ is

    1. Critically important
    2. Completely irrelevant
    3. The key to wealth and success
    4. Something you can return to later
    Show answer

    D. Something you can return to later

  6. The scope resolution operator usually

    1. Providing a useful conceptual frame work
    2. Specifies a particular class
    3. Tells what base class is derived from
    4. Limits the visibility of variables to a certain function
    Show answer

    B. Specifies a particular class

  7. An enumerated data type brings together a group of

    1. Constant values, integers with user defined names
    2. Related data type
    3. Items of different data type
    4. All of these
    Show answer

    A. Constant values, integers with user defined names

  8. A variable defined within a block is visible

    1. From the point of definition onward in the block
    2. From the point of definition on ward in the function
    3. From the point of definition on ward in the program
    4. Throughout the function
    Show answer

    A. From the point of definition onward in the block

  9. The library function exit( ) causes an exit from

    1. The program in which it occurs
    2. The function in which it occurs
    3. The block in which it occurs
    4. The loop in which it occurs
    Show answer

    A. The program in which it occurs

  10. The names beginning with an underscore are reserved for _____ variable.

    1. Globar
    2. Local
    3. Internal system
    4. External system
    Show answer

    C. Internal system

  11. ____ literals are treated as array of characters.

    1. Graphic
    2. Character
    3. String
    4. Non-graphic
    Show answer

    C. String

  12. Which one holds the values or constants in memory boxes?

    1. Variable
    2. While
    3. Goto
    4. Switch
    Show answer

    A. Variable

  13. Advertisement
  14. In which type of constant the Decimal numbers, integer and floating-point are related?

    1. Numeric
    2. String
    3. Char
    4. Boolean
    Show answer

    A. Numeric

  15. The basic types are collectively called as ___

    1. Looping
    2. Tokens
    3. Expression
    4. Variables
    Show answer

    B. Tokens

  16. ____ are data items whose value cannot be changed.

    1. Class
    2. Return
    3. Constants
    4. Variable
    Show answer

    C. Constants

  17. Which punctuator is used to group a set of C++ statements?

    1. {}
    2. []
    3. ()
    4. /
    Show answer

    A. {}

  18. ____ refers to the process of changing the data type of the value stored in a variable.

    1. Type char
    2. Type int
    3. Type float
    4. Type cast
    Show answer

    D. Type cast

  19. ____ data types are structure, union, class and enumeration.

    1. Derived
    2. Integer
    3. Built-in
    4. User defined
    Show answer

    D. User defined

  20. Which operator is used to compare numerical values?

    1. Relational
    2. Conditional
    3. Assignment
    4. Arithmetic
    Show answer

    A. Relational

  21. ____ allocates memory, based on the data type of the variable.

    1. Interpreter
    2. Link
    3. Converter
    4. Compiler
    Show answer

    D. Compiler

  22. Every variable will be referred by its ___

    1. Data
    2. Int
    3. Name
    4. Address
    Show answer

    D. Address

  23. Which storage class defines local variable known to the block in which they are defined?

    1. Register
    2. Auto
    3. Extern
    4. Static
    Show answer

    B. Auto

  24. ____ allows users to define the user defined data type identifier.

    1. Class
    2. Data
    3. Identifier
    4. Type definition
    Show answer

    D. Type definition

  25. What is the length of long double data type?

    1. 8
    2. 16
    3. 32
    4. 80
    Show answer

    D. 80

  26. Advertisement
  27. When a=6 and c=a++ what is the value of c?

    1. 6
    2. 7
    3. 8
    4. 9
    Show answer

    A. 6

  28. The statement int A; b; is invalid because ____

    1. Variables should be separated by Comma
    2. Capital A is not allowed
    3. Only one variable should be given
    4. All of these
    Show answer

    A. Variables should be separated by Comma

  29. What is the default file extension for all Word documents?

    1. FIL
    2. DOC
    3. WRD
    4. TXT
    Show answer

    B. DOC

  30. The ____ key and the ___ key can be used in combination with other keys to perform shortcuts and special tasks.

    1. Control, Alt
    2. Function, toggle
    3. Delete, Insert
    4. Caps Lock, Num Lock
    Show answer

    A. Control, Alt

  31. How many operators are classified in C++?

    1. 11
    2. 13
    3. 14
    4. 15
    Show answer

    B. 13

  32. ____ is the C increment Operator in C++.

    1. ++
    2. +*
    3. *+
    4. --
    Show answer

    A. ++

Advertisement