Online Test for C++

  1. Which of the following operator(s) cannot be overloaded?
    . (Member Access or Dot operator)
    ?: (Ternary or Conditional Operator )
    :: (Scope Resolution Operator)
    All of the above

  1. Which of the following is user defined data type?
    Public
    Private
    Class
    A & B Both


  1. In c++ object of the class is also called?
    Constants
    Tag
    Instance
    Data collection

  1. ________ is a default access specifier for members of structures in C++.
    protected
    public
    private
    default

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

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


  1. Which of the following is not a member of class?
    Static function
    Friend function
    Const function
    Virtual function

  1. Which of the following mode declaration is used in C++ to open a file for input?
    ios :: app
    in :: ios
    ios :: in
    ios :: file

  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. What features make C++ so powerful?
    Easy implementation
    Code reusability
    Easy memory management
    All the above

Post Your Question
Social Sharing
Search