Masters of Computer Application (C++)
C++ - An Objective Type Test for the Beginners Who Want to Start their Career in Object Oriented Programming Languages
Questions
How many types of storage classes are there in C++?
- 4
- 5
- 3
- None of the above
What is the output of the following program?
#include
void main()
{ enum birds{parrot,crow,pigeon,sparrow};
birds b=pigeon;
cout<
}
- pigeon
- 3
- 2
- none of the above
A function may return a reference or a pointer variable also.
- True
- False
Which one of the following error handling functions of ios class returns true, when an input or an output operation on file has failed?
- bad()
- good()
- eof()
- fail()
- is also called the _________.
- address of operator
- reference operator
- value operator
- indirection operator
State, if the following comment is valid or not.
/* An apple /* a day keeps */ the doctor away */
- Valid
- Invalid
Is it important to define a virtual function in a base class even though it may not be used?
- Yes
- No
When a derived class is the base class of some other class, then this type of inheritance is known as ___________.
- hierarchical inheritance
- multiple inheritance
- multilevel inheritance
- hybrid inheritance
What is the output of the following program?#include
void main()
{
int x=7,y=6,z;
z=x-- -y;
cout<
}
- 1
- 0
- -1
- None of the above
Suppose p, q, r are integer variables with value 10, 20, 30 respectively. What will be the value of the following expression?
! ((q+r)>(r-10))
- 0
- 1
- -1
- None of the above
What is the output of the following expression?
int a=16,b= -8;
cout<
- 1
- 0
- - 1
- 0.0
What would be the output, if the input given to 'a' is Ram Krishan Verma?#include<iostream.h>
void main()
{
char a[10];
cin.getline(a,10);
cout<<a;
}
- Ram Krish
- Ram Krisha
- Ram Krishan
- Ram Krishan Verma
The following expression evaluates to the value _____.
0 + 1 * 3 - 1 * 5
- 10
- -10
- -2
- 2
An object pointer can point to private members of a class.
- True
- False
Which one of the following file modes allows us to add data or to modify the existing data anywhere in the file?
- ios::app
- ios::ate
- ios::out
- ios::trunc
What will be the output of the following program? void main()
{
int z[]={5,6,7,8,9,10};
int *p;
p=z;
cout<<*p+1;
}
- Base address of z
- 5
- 6
- Unknown value
What is the output of the following expression?
int a=16,b= -8;
cout<
- 1
- 0
- -1
- 0.0
How many types of storage classes are there in C++?
- 4
- 5
- 3
- None of the above
External variable is automatically initialized to ___________.
- 0
- 1
- -1
- None of the above
How many times will the following statement be executed?void main()
{
int a;
a=100;
while(a>=100)
{
cout<< hello ;
--a;
}
}
- Never
- Once
- 100
- 99
Which function in a stream sets the current get position?
- seekg()
- seekp()
- get()
- tellg()
What is the output of the following program?
#include<iostream.h>
void main()
{
enum birds{parrot,crow,pigeon,sparrow};
birds b=pigeon;
cout<<b;
}
- pigeon
- 3
- 2
- none of the above
What will be the output of the following program?
- Winter Autumn
- Autumn
- Summer Autumn
- Winter
What is the output of the following program?
void main()
{
int z[]={5,6,7,8,9,10};
int *p;
p=z;
cout<<*p+1;
}
- Base address of z
- 5
- 6
- None of the above
What is the output of the following program? void main()
{
int m=10;
int *p=&m;
(*p)++;
cout<<(*p)++;
}
- 12
- 11
- 10
- Address of m
What will be the output of the following program?#include<iostream.h>
class sun
{
public:
void result()
{
cout<< class sun ;
}
};
class moon
{
public:
void result()
{
cout<< class moon ;
}
};
class stars:public sun,public moon
{
public:
void show()
{
cout<< class stars ;
}
};
void main()
{
stars s;
s.result();
}
- class stars
- class moon
- class sun
- none of the above
What will be the output of the following program?
#include<iostream.h>
class sun
{
public:
void result()
{
cout<< class sun ;
}
};
class moon
{
public:
void result()
{
cout<< class moon ;
}
};
class stars:public sun,public moon
{
public:
void show()
{
cout<< class stars ;
}
};
void main()
{
stars s;
s.result();
}
- class stars
- class moon
- class sun
- none of the above
Which one of the following languages is not an object oriented programming language?
- Ada
- Smalltalk
- Java
- Object Pascal
By default, the members of a structure are __________.
- private
- public
- protected
- none of these
External variable is automatically initialized to ___.
- 0
- 1
- -1
- none of the above