Saturday, September 15, 2012

CS 201 Quize



Question # 1
What does 5 | 6 , evaluate to in decimal where ‘|’ is bitwise OR operator?
1) :
3
2) :
4
3) :
5
4) :
7
Correct Option :        
From :


Question # 2
We can also use member functions with cin and cout objects
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        2
From :


Question # 3
If the statements
int j,k;
j = 123;
k= 234;
int* q, * r;
cout < < *q < < ' ' < < * r ;
are executed, what will be displayed?
1) :
The values of j and k
2) :
The addresses of q and r
3) :
The addresses of j and k
4) :
garbage values
Correct Option :        4
From :
Lecture 14

Question # 4
Which one of the following operators is a unary operator?
1) :
OR ( || )
2) :
AND ( &&)
3) :
XOR ( ^ )
4) :
Complement operator ( ~ )
Correct Option :        4
From :
Lecture 16

Question # 5
The statement i++; is equivalent to
1) :
i = i + i;
2) :
i = i + 1;
3) :
i = i - 1;
4) :
i --;
Correct Option :        2
From :
Lecture 16

Question # 6
A variable which is defined inside a function is called
1) :
Automatic variable
2) :
Global variable
3) :
Functional variable
4) :
None of the given option
Correct Option :        3
From :
Lecture 16

Question # 7
If we open a file stream myfile for reading, what will give us the current position of the file pointer?
1) :
tellg()
2) :
tellp()
3) :
seekg()
4) :
seekp()
Correct Option :        1
From :
Lecture 19

Question # 8
Application Software’s are use to
1) :
Type letters
2) :
Control computer hardware
3) :
Solve end user problems
4) :
Develop Graphics
Correct Option :        3
From :
Lecture 2

Question # 9
When we write a class template the first line must be:
1) :
template < class class_type>
2) :
template < class data_type>
3) :
template < class T >, Here T can be replaced with any name but it is preferable.
4) :
class template
Correct Option :        3
From :
Lecture 21

Question # 10
When a macro takes arguments then it is called_________________.
1) :
Function
2) :
Procedure
3) :
Parameterized macro
4) :
Simple macro
Correct Option :        3
From :
Lecture 23

Question # 11
By default an array of characters is passed by value to a function,
1) :
TRUE
2) :
FALSE
3) :

4) :

Correct Option :        2
From :
Lecture 23

Question # 12
Using dynamic memory is more efficient then the static memory.
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        1
From :
Lecture 24

Question # 13
Using dynamic memory is more _____________ then the static memory.
1) :
Costly
2) :
Expansive
3) :
efficient
4) :
Difficult
Correct Option :        3
From :
Lecture 24

Question # 14
Before exiting the program, make sure that the allocated memory has freed.
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        1
From :
Lecture 24

Question # 15
A preprocessor directive is identified by _________ symbol
1) :
#
2) :
$
3) :
%
4) :
##
Correct Option :        1
From :
Lecture 25

Question # 16
The default constructor has no arguments
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        1
From :
Lecture 26

Question # 17
The data members of the class are initialized at runtime
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        1
From :
Lecture 26

Question # 18
The data members of the class are initialized at creation Time
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        2
From :
Lecture 26

Question # 19
The function call to a default constructor
1) :
looks like any function call, except there is no return value
2) :
never takes any arguments
3) :
creates but cannot initialize an object
4) :
is made automatically when an object is created
Correct Option :        4
From :
Lecture 26

Question # 20
A friend function of a class has access
1) :
To all data member and functions of the class
2) :
Only to other friend functions of the class
3) :
Only to private data of the class
4) :
Only to public data of the class
Correct Option :        3
From :
Lecture 26

Question # 21
The new operator
1) :
is used to declare objects or variables
2) :
can not create and initialize an object
3) :
names an object or variable
4) :
can allocate an appropriate amount of memory for an object or variable
Correct Option :        4
From :
Lecture 26

Question # 22
Explicitly write keyword private in the class definition
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        1
From :
Lecture 26

Question # 23
There is a class Student, Which one of the following is a valid destructor for this class.
1) :
Student();
2) :
~ Student();
3) :
~ Student(int);
4) :
int~ Student();
Correct Option :        2
From :
Lecture 27

Question # 24
The reserved words public and private comes under the category
1) :
structures
2) :
strings
3) :
accessibility modifiers
4) :
types of functions
Correct Option :        1
From :
Lecture 27

Question # 25
There is a class Student, Which one of the following is a valid destructor for this class.
1) :
Student();
2) :
Student(int);
3) :
~ Student();
4) :
~ Student(int);
Correct Option :        3
From :
Lecture 27

Question # 26
The function call to a default constructor
1) :
looks like any function call, except there is no return value
2) :
is made automatically when an object is created
3) :
creates but cannot initialize an object
4) :
never takes any arguments
Correct Option :        2
From :
Lecture 27

Question # 27
The new operator
1) :
can allocate an appropriate amount of memory for an object or variable
2) :
can not create and initialize an object
3) :
is used to declare objects or variables
4) :
returns a pointer to an object or variable
Correct Option :        4
From :
Lecture 28

Question # 28
The new operator
1) :
is used to declare objects or variables
2) :
can not create and initialize an object
3) :
names an object or variable
4) :
can allocate an appropriate amount of memory for an object or variable
Correct Option :        4
From :
Lecture 28

Question # 29
Which of the following operators can not be overloaded?
1) :
new
2) :
delete
3) :
+=
4) :
sizeof
Correct Option :        2
From :
Lecture 28

Question # 30
Analyze the following code
class myclass
{
private:
float x,y;
public:
void myclass
(float a, float b)
{
x=a;
y=b;
}
void diplay()
{
cout<<ENDL<<X<<ENDL<<Y;
}
};
What is wrong with the above code?
1) :
The member functions should be private
2) :
constructor must not have a return type
3) :
The constructor should have no body
4) :
There is no error in the given code
Correct Option :        2
From :
Lecture 28

Question # 31
this is a pointer which always points to the current object.
1) :
TRUE
2) :
FALSE
3) :

4) :

Correct Option :        1
From :
Lecture 28

Question # 32
Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int?
1) :
new int(10) ;
2) :
new int[10] ;
3) :
int new(10) ;
4) :
int new[10];
Correct Option :        4
From :
Lecture 28

Question # 33
The function free() returns back the allocated memory got thorough calloc and malloc to _____ .
1) :
stack
2) :
heap
3) :
stack and heap
4) :
None of the given options
Correct Option :        2
From :
Lecture 28

Question # 34
Whenever new operator is used, no number of bytes or sizeof operator is required.
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        1
From :
Lecture 28

Question # 35
If the memory in the free store is not sufficient enough to fulfill the request, malloc() function returns NO pointer.
1) :
True
2) :
FALSE
3) :

4) :

Correct Option :        2
From :
Lecture 28

Question # 36
A friend function
1) :
must be having a prototype with no arguments
2) :
can access the private data of the class that declares it a friend
3) :
cannot access the data members of a class
4) :
must be invoked by the class that declares it a friend
Correct Option :        2
From :
Lecture 29

Question # 37
A function declaration has the same relationship to a function definition that
1) :
a class definition has to an object definition
2) :
an object declaration has to an object
3) :
a variable has to a variable declaration
4) :
a variable declaration has to the variable itself
Correct Option :        3
From :
Lecture 29

Question # 38
A friend function
1) :
must be having a prototype with no arguments
2) :
must be invoked by the class that declares it a friend
3) :
must be invoked by an object of the class that declares it a friend
4) :
can access the private data of the class that declares it a friend
Correct Option :        4
From :
Lecture 29

Question # 39
The reserved words public and private comes under the category
1) :
structures
2) :
strings
3) :
accessibility modifiers
4) :
types of functions
Correct Option :        3
From :
Lecture 29

Question # 40
The prototype of friend functions must be written ____ the class and its definition must be written ____
1) :
inside, inside the class
2) :
inside, outside the class
3) :
outside, inside the class
4) :
outside, outside the class
Correct Option :        2
From :
Lecture 29

Question # 41
In functions that return reference, use __________variables.
1) :
Local
2) :
Global
3) :
Global or static
4) :
None of the given option
Correct Option :        3
From :
Lecture 30

Question # 42
Operator Overloading is quite similar to Function Overloading.
1) :
True
2) :
FALSE
3) :