Online Test for C++

  1. The static member variable is initialized to?
    0
    1
    2
    -1

  1. Which of the following correctly describes overloading of functions?
    Virtual polymorphism
    Transient polymorphism
    Ad-hoc polymorphism
    Pseudo polymorphism


  1. Find Error/Output in follwing code:
  2.                                 
    #include <iostream>  
    
    using namespace std;  

    void square (int *x)  {
        *x = (*x)++ * (*x);  


    void square (int *x, int *y) {
        *x = (*x) * --(*y); 


    int main ( ) {
        int number = 30;          
        square(&number, &number);           
        cout << number;           
        return 0;  
    }
    910
    920
    870
    900

  1. Member of a class specified as _______ are accessible only to method of the class.
    private
    public
    protected
    derive

  1. Sub classes may also be called Child classes/Derived classes.
    True
    False

  1. Which of the following cannot be passed to a function in C++?
    Constant
    Structure
    Array
    Header file


  1. Data members is also called?
    Attribute
    Method
    Class
    Object

  1. If class A inherits from more than one class, ie. A inherits from B1, B2,... is called
    Single Inheritance
    Multilevel Inheritance
    Multiple Inheritance
    None of the above

  1. What is pointer?
    The variable that stores the reference to another variable
    The variable that stores reference of garbage variable
    The variable that stores the memory address of another variable
    A & C Both

  1. It is not possible to achieve inheritance of structures in c++?
    True
    False

Post Your Question
Social Sharing
Search