operators
datatypes
classes and syntax
General
general
100

What are/is the operator/operators used to access the class members?

Dot (.) and Arrow ( -> )

100

bool

What is the data type to store the Boolean value?

100

Defining several functions with the same name with unique list of parameters

What is function overloading?

100

cin, cout, cerr and clog

Name the default standard streams in C++.

100

Defining a new job for the existing operator w.r.t the class objects is called as

What is operator overloading?

200

Which access specifier/s can help to achive data hiding in C++?

Private & Protected.

200

Scope resolution operator (::)

When a class member is defined outside the class, which operator can be used to associate the function definition to a particular class?

200

What is a destructor? Can it be overloaded?

A destructor is the member function of the class which is having the same name as the class name and prefixed with tilde (~) symbol. It gets executed automatically w.r.t the object as soon as the object loses its scope. It cannot be overloaded and the only form is without the parameter

200

What is a constructor?

A constructor is the member function of the class which is having the same as the class name and gets executed automatically as soon as the object for the respective class is created.

200

‘new’ is the operator can be used for the same.

Which operator can be used in C++ to allocate dynamic memory?

300

Can I use malloc() function of C language to allocate dynamic memory in C++?

Yes, as C is the subset of C++, we can all the functions of C in C++ too.

300

This, is the pointer variable of the compiler which always holds the current active object’s address.

what is this?

300

What is the difference between the keywords struct and class in C++?

By default the members of struct are public and by default the members of the class are private

300

Can we implement all the concepts of OOPS using the keyword struct?

yes

300

What is a namespace?

A namespace is the logical division of the code which can be used to resolve the name conflict of the identifiers by placing them under different name space.

400

What are command line arguments?

The arguments/parameters which are sent to the main() function while executing from the command line/console are called so. All the arguments sent are the strings only.

400

What is reminder for 5.0 % 2?

Error, It is invalid that either of the operands for the modulus operator (%) is a real number.

400

Which compiler switch to be used for compiling the programs using math library with g++ compiler?

Opiton –lm to be used as > g++ –lm <file.cpp>

400

Who designed C++ programming language? with spelling...

Bjarne Stroustrup.

400

What is the maximum length of an identifier?

Ideally it is 32 characters and also implementation dependent.

500

What is the output of the following program?

#include<iostream>

using namespace std;
main() {   short unsigned int i = 0;       cout<<i--;
}

0

500

What is the output of the following program?#include<iostream>
using namespace std;
main() {   char  *s = "Fine";
                          *s = 'N';     cout<<s<<endl;
}

Runtime error

*s=’N’, trying to change the character at base address to ‘N’ of a constant string leads to runtime error.

500

#include<iostream>    using namespace std;

class Empty {};

  int main()

{ cout << sizeof(Empty);

  return 0;  }

1

500

class Test {  int x;  }; 

int main() 

{   Test t;  cout << t.x; 

  return 0; } 

In C++, the default access is private. Since x is a private member of Test, it is compiler error to access it outside the class.

500

Predict the output following program

#include<iostream> 

using namespace std; 

 class Test 

{  static int x;   int *ptr;  int y;  }; 

  int main() 

{  Test t;  cout << sizeof(t) << " "; 

    cout << sizeof(Test *);  } 

8   4

M
e
n
u