FOR MORE PAPERS | LOGON TO WWW.VUSSS.
COM
FINAL TERM
CS201- Introduction to Programming
Q # 01: Which one of the symbol is used to represent a decision in a
flow chart ?
Q # 02: The _________ statement is frequently used to terminate
the processing of a particular case within a switch statement.
Continue
Goto
Break
Default
Q # 03: The goto statement is a/an ____________ branch of
execution.
Conditional
Unconditional
Multiple
Limited
Q # 04: In ________, the first pointer stores the address of the
some other pointer, which contains the address of any variable.
single dereference
double dereference
single reference
double reference
Q # 05: If we have x = 7 then the new value of x after evaluating
the expression x%= 2 is ________
2
3
1
7
Q # 06: Whenever we use a library function or a predefined object
or macro, we need to use a _________
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 1 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
source file
object file
header file
exe file
Q # 07: If the return type of a function is void then it means that it
will _________.
return any type of data
return some specific type of data
return no data
return just character data
Q # 08: Identify the correct option which is used for calling the
function float area (int).
area(&num) ;
area(num) ;
area(int num) ;
area(*num) ;
Q # 09: The _________ statement allows us to select from multiple
choices based on a set of fixed values for a given expression.
Switch
Break
Continue
goto
Q # 10: Syntax of a union is identical to __________ .
Structure
Class
function
loop
Q # 11: How many number of arguments operator functions for <<
and >> operators take?
► One
► Two
► Three
► No arguments
Q # 12: The operator function for stream insertion(>>) and stream
extraction (<<) must be ____________.
A member function of class
Non-member function of class
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 2 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Can be a member and non-member function
A constructor of the class
Q # 13: A pointer is a special type of variable that contains
___________.
Data values
Memory address
Both values and memory addres
The variables having memory address
Q # 14: _________ operator is used to return memory to free store,
which is allocated by the new operator.
Remove
Delete
Return
Old
Q # 15: If overloaded plus operator is implemented as member
function then which of the following option will be true for the
statement given below?
obj3 = obj1 + obj2 ;
obj1 will be passed as an argument to + operator whereas obj2 will
drive the + operator
obj1 will drive the + operator whereas obj2 will be passed as an
argument to + operator
Both objects (obj1, obj2) will be passed as arguments to the +
operator
Any of the objects (obj1, obj2) can drive the + operator
Q # 16: If overloaded plus operator is implemented as member
function then which of the following option will be true for the
statement given below?
obj3 = obj1 + obj2 ;
obj1 will be passed as an argument to + operator whereas obj2 will
drive the + operator
obj1 will drive the + operator whereas obj2 will be passed as an
argument to + operator
Both objects (obj1, obj2) will be passed as arguments to the +
operator
Any of the objects (obj1, obj2) can drive the + operator
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 3 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Q # 17: A template function must have at least _______________
generic data type.
Zero
One
Two
Three
Q # 18: With template function, the compiler automatically detects
the ___________ and generates ______________ using passed
data.
passed data , a new copy of function
parameters, an old copy of function
old copy of function, parameters
None of the given
Q # 19: In the member initializer list, the data members are
initialized ____________.
From left to right
From right to left
In the order in which they are defined within class
There is no order for initialization
Q # 20: A class whose object is contained as const object, must have
____________.
Getter/Setter Functions
Default Constructor
Parameterized Constructor
Operator Overlaoding Functions
Q # 21: The initializer list is used to initialize the contained objects
of a class at __________.
Run time
Debugging time
Construction time
Compile time
Q # 22: Which of the following statement is true about Assignment
operator (=) and output stream ‘cout’?
Assignment operator is left associative whereas cout is right
associative.
Assignment operator is right associative whereas cout is left
associative.
Both (Assignment operator, output stream ‘cout’) are right associative.
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 4 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Both (Assignment operator, output stream ‘cout’) are left associative.
Q # 23: There are ________ basic types of streams.
One
Two
Three
Four
Q # 24: The input/output streams cin and cout are ________
therefore have _______.
► Structures, function
► Objects, member functions
► Functions, objects
► None of the given options
Q # 25: When an object of a class is defined inside another class
then ______________.
Destructor of enclosing class will be called first
Destructor of inner object will be called first
Constructor and Destructor will be called simultaneously
Only destructor will be called
Q # 26: The order of destruction of an object is ________.
same as the construction order.
reverse as the construction order.
independent of the construction order.
same as the order of objects declared.
Q # 27: A constructor will create a new object with a full copy of
the other object, this type of copy is known as ___________.
Deep copy
Shallow copy
Constructor copy
Object copy
Q # 28: All preprocessor directives are started with the
symbol______.
*
++
@
#
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 5 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Q # 29: Which one is the correct syntax for defining an identifier PI
with preprocessor directive?
#define PI 3.1415926;
#define PI 3.1415926
#define PI = 3.1415926 ;
#define PI = 3.1415926
Q # 30: Which of the following is NOT a preprocessor directive?
#error
#define
#line
#ndefine
Q # 31: Which is NOT a protection level provided by classes in C++?
► protected
► hidden
► private
► public
Q # 32: Which value is returned by the destructor of a class?
► A pointer to the class.
► An object of the class.
► A status code determining whether the class was destructed correctly
► Destructors do not return a value.
Q # 33: In overloaded functions, the appropriate function to be
called is resolved by _________.
Type of arguments
Number of arguments
Return type
Both, Type and Number of arguments
Q # 34: Which of the following function call is correct for the
function prototype?
defaultParameters ( int a, int b = 7, char z = ‘*’ );
► defaultParameters (5);
► defaultParameters (5, ‘8’);
► defaultParameters (6, ‘#’);
► defaultParameters (0, 0, ‘*’, 0);
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 6 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Q # 35: The region of memory, available for allocation at run time in
C language is called ________ memory whereas in C++ , is called
________________.
Heap, Stack
Stack, Free Store
Heap, Free Store
Free store, Heap
Q # 36: The operator function will be implemented as _____, if obj1
drive the - operator whereas obj2 is passed as arguments to -
operator in the statement given below.
obj3 = obj1 - obj2;
► Member function
► Non-member function
► Friend function
► None of the given options
Q # 37: In overloading the assignment (=) operator, which object
will call the operator function?
Both objects will call the assignment operator
No object will call the assignment operator
Right object of the assignment operator
Left object of the assignment operator
Q # 38: Let suppose
a=b=c
In such situation, return a __________ reference from the
overloaded assignment operator function.
Const
non-const
const object
Object
Q # 39: Suppose we have a class myClass with a constructor of one
argument. While declaring an array of 5 objects, correct syntax for
initializing first 2 objects of array would be __________.
myClass array[5] = [myClass(“BS-CS”), myClass(“MCS”)];
myClass array[5] = { myClass(“BS-CS”), myClass(“MCS”)};
myClass array[5] = myClass(“BS-CS”), myClass(“MCS”);
myClass array[5] = myClass1 = (“BS-CS”), myClass2 = (“MCS”);
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 7 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Q # 40: At global level, drawback of overloading new operator is
that ______________.
The user's intended memory will not be allocated to objects
dynamically.
Built-in new operator will not be visible in whole program. Overloaded
new operator will be called every time.
Overloading new operator will not allow user to declare dynamic arrays
of objects.
Dynamic memory allocation is not possible
Question No: 41 ( Marks: 2 )
What is the output of the following program?
#include <iostream.h>
main ( )
{
int x, y;
x = 15;
y = 10;
x = x + y;
y=x-y;
x=x-y;
cout << “The value of x is ” << x;
}
Question No: 42 ( Marks: 2 )
Write the statement for allocating memory dynamically to an integar array of
size 5 using new operator.
Question No: 43 ( Marks: 2 )
Suppose there is a template function 'func' having argument of type U and
return type T. What will be the C++ syntax to call this function, when we
pass a variable 'x' of type double and it is returning an int type?
Question No: 44 ( Marks: 2 )
What is returned by new operator?
Question No: 45 ( Marks: 3 )
Briefly explain the purpose of using the each of the statement given below.
1. #define pi 3.1416
2. float pi = 3.1416 ;
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 8 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Question No: 46 ( Marks: 3 )
Are friend functions member- functions of the class? How they access data
members and member functions of class?
Question No: 47 ( Marks: 3 )
What will be the output of the following code segment?
class myclass{
public:
static int x;
myclass(){
x++;
}
};
myclass::x=0;
main(){
myclass obj1, obj2;
cout << obj1.x << “\t” << obj2.x ;
}
Question No: 48 ( Marks: 3 )
Find the error in the given code
for ( int i=0; i<numRows; i++)
{
for(int j=0; j<numCols; j++)
{
elements[i , j] = m.elements[i][j];
}
}
Question No: 49 ( Marks: 5 )
Write a C++ Program that asks the user to input the radius of the circle and
calculates its area.
Hint: Area of Circle = 3.14 * Radius * Radius
Question No: 50 ( Marks: 5 )
Find the errors in given code segment and also correct them.
class Data
{
private:
const int data;
public:
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 9 of 10
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
FINAL TERM
Data()
{
cout<<”Constructor Called…\n ”;
}
void getIncreament()
{
cout<<”Data = ” << ++ data;
}
};
void main()
{
char * String ;
String = New char[15];
String = “Welcome To VU”;
cout<<String;
free (String);
}
Question No: 51 ( Marks: 5 )
Write a program which defines two variables var1 and var2 of type int which
store two different values. Print the values of these variable in three different
number systems using manipulators dec, hex, oct.
Question No: 52 ( Marks: 5 )
Write a program which defines a Template function named Add () which
adds two variables and then returns the sum. Define two variables of type
double in main function, and then call Add () function on these variables.
Program output should look like this:
Enter two double values to be added
Enter First value:
12354.23
Enter Second value:
2563.25
Addition of two variable of double data type
Sum = 14917.5
FOR MORE PAPERS | LOGON TO WWW.VUSSS.COM
Page 10 of 10