Genesis Insoft The name you can TRUST
twitterlogo facebooklogo
Home  |  Contact Us |  Careers
C++ Question Bank / FAQs

This is a mock Exam for the C++ programmers. It is created by Genesis InSoft Limited (admin@genesisinsoft.com) and may be freely distributed so long as it is unmodified. Please email us if you have any corrections or comments.

Question1

The phenomenon where the object outlives the program execution time and exists between executions of a program is known as.

  1. Global Object
  2. Persistent Object 
  3. Genericity 
  4. Delegation

Answer to Question 1

Question 2

Object-Based Programming Language supports

  1. Inheritance 
  2. Polymorphism 
  3. Encapsulation 
  4. All of the above

Answer to Question 2

Question 3

Abstraction is crucial to understanding

  1. Class
  2. Application  
  3. Object 
  4. Control flow

Answer to Question 3

Question 4

Object oriented design decomposes a system into

  1. Classes 
  2. Objects 
  3. Structures 
  4. Methods

Answer to Question 4

Question 5

If a class member function is declared a const, the function

  1. Does not change the value of any data member of that class
  2. Does not change the value of any data member of implied object
  3. Does not change the value of any data member of that class
  4. All of the above

Answer to Question 5

Question 6

What is the output of the program?

    #include <stdio.h>

    float cal (float value)
    {
        return (3 * value);
    }

    void main()
    {
        int a = 10;
        float b = cal ("123");
    }

  1. 369
  2. 123
  3. Compilation error - Cannot convert from char to float
  4. None of the above 

Answer to Question 6

Question 7

The act of grouping into a single object, both data and the operation that affect that data is known as

  1. Encapsulation 
  2. Inheritance 
  3. Abstraction 
  4. None of the above

Answer to Question 7

Question 8

What is a class?

  1. It is a region of storage. 
  2. It defines a data type. 
  3. It is exactly same as a struct in c. 
  4. All of the above.

Answer to Question 8

Question 9

What is the output of the program?

    #include <iostream.h>

    void main ()
    {
        for(int j = 1, sum = 0; j < 5; j++)
            sum += j;
        sum = j;
        cout << sum;
    }

  1. 5
  2. 10
  3. Compilation error. Undefined variable sum and j

Answer to Question 9

Question 10

Which one supports unknown data types in a single framework?

  1. Inheritance 
  2. Virtual functions 
  3. Templates 
  4. Abstract Base Class

Answer to Question 10

Question 11

Inheritance is expressed by the following statement?

  1. class car : public vehicle 
  2. class car extends vehicle 
  3. public class car extends vehicle 
  4. class car inherits vehicle

Answer to Question 11

Question 12

Object oriented design decomposes a system into

  1. Classes 
  2. Objects 
  3. Structures 
  4. Methods

Answer to Question 12

Question 13

Which of the following statements is not correct?

  1. You can create new operators like $ or @
  2. You cannot change an operator's template
  3. Operators can only be overloaded when used with abstract data class
  4. Unary operators overloaded by means of a member functions takes no explicit arguments and return no explicit values

Answer to Question 13

Question 14

Which of the following is false about struct and class in C++?

  1. The members and base classes of a struct are public by default, while in class, they are private by default
  2. Struct and class are otherwise functionally equivalent
  3. A class supports all the access specifiers like private, protected and public
  4. A struct cannot have protected access specifier

Answer to Question 14

Question 15

Protected keyword is frequently used

  1. For function overloading
  2. For protecting data 
  3. For inheritance 
  4. For security purpose

Answer to Question 15

Question 16

Abstract base class is one, which has

  1. All pure virtual functions 
  2. At least one pure virtual function 
  3. Functions with abstract keyword 
  4. No pure virtual functions

Answer to Question 16

Question 17

What is exception handling?

  1. Errors which occur at runtime 
  2. When abnormal situation arises at compile time 
  3. When errors occur at link time
  4. None of the above

Answer to Question 17

Question 18

What is the output of the program?

    #include <iostream.h>

    inline int max(int x, int y)
    {
        return(x > y ? x : y);
    }

    void main()
    {
        int(* max_func)(int,int)=max;
        cout << max_func(75,33);
    }

  1. 75
  2. Error - Undefined symbol max_func
  3. 33
  4. None of the above

Answer to Question 18

Question 19

Which keyword is used to decide on the choice of function or method at runtime?

  1. Abstract 
  2. Virtual 
  3. Protected 
  4. Static

Answer to Question 19

Question 20

Which of the following is a correct statement?

  1. Abstract class object can be created 
  2. Pointer to abstract class can be created 
  3. Reference to abstract class can be created
  4. Both B and C

Answer to Question 20

Answers

Answer 1 - B

Back to question 1

Answer 2 - C

Back to question 2

Answer 3 -  C

Back to question 3

Answer 4 - B

Back to question 4

Answer 5 - B

Back to question 5

Answer 6 - C

Back to question 6

Answer 7 - A

Back to question 7

Answer 8 - B

Back to question 8

Answer 9 - A

Back to question 9

Answer 10 - C

Back to question 10

Answer 11 - A

Back to question 11

Answer 12 - B

Back to question 12

Answer 13 - A

Back to question 13

Answer 14 - D

Back to question 14

Answer 15 - C

Back to question 15

Answer 16 - B

Back to question 16

Answer 17 - A

Back to question 17

Answer 18 - A

Back to question 18

Answer 19 - B

Back to question 19

Answer 20 - D

Back to question 20

Copyright © 2000 to 2024 Genesis InSoft Limited. All Rights Reserved.