(Session – 1 )
Marks: 50
Time: 120min
StudentID/LoginID: ______________________________
Student Name: ______________________________
Center Name/Code: ______________________________
Exam Date: Wednesday, August 23, 2006

Please read the following instructions carefully before attempting any
of the questions:
1. Attempt all questions. Marks are written adjacent to each question.
2. Do not ask any questions about the contents of this examination
from anyone.
a. If you think that there is something wrong with any of the
questions, attempt it to the best of your understanding.
b. If you believe that some essential piece of information is
missing, make an appropriate assumption and use it to solve the
c. Write all steps, missing steps may lead to deduction of marks.
d. All coding questions should be answered using the C ++ syntax.
You are allowed to use the Dev-C++ compiler to write and test your code. If
you do so please remember to copy and paste your code into the examination
solution area. (Do NOT share your code; your colleague could get higher
marks than you!!)
**WARNING: Please note that Virtual University takes serious note of
unfair means. Anyone found involved in cheating will get an `F` grade
in this course.
For Teacher’s use only
Question 1 2 3 4 5 6 7 8 9 Total

Question No: 1
( Marks: 2 )
– Please choose one
A for loop usually consist of __________ expressions.
► 1
► 3
► 2
► 4
Question No: 2
( Marks: 2 )
– Please choose one
A preprocessor directive is identified by _________ symbol
► #
► {
► (
► ~
Question No: 3
( Marks: 2 )
– Please choose one
Which of the following operators can not be overloaded?
► new
► delete
► +=
► sizeof
Question No: 4
( Marks: 2 )
– Please choose one

Analyze the following code
class myclass
float x,y;
void myclass(float a, float b)
void diplay()
What is wrong with the above code?
► The member functions should be private
► constructor must not have a return type
► The constructor should have no body
► There is no error in the given code
Question No: 5
( Marks: 6 )
Analyze the following code and list all the errors and line numbers in the given code.
int i=2;
cout<<” is even /n’;
Question No: 6
( Marks: 7 )
Declare a class student having the following data members and member functions in the

stdname(character array of size 20)
phone(long integer)
getdata() function that will read data into members data.
Display() function that will display the data on the screen.
Question No: 7
( Marks: 6 )
a. Write the statement that will create an array of 10 objects of the class student and
place the base address of the array in a pointer ptr of the class student given in Question
No. 6.
b. Write the code of the parameterized constructor for the class student given in
Question No. 6.
Question No: 8
( Marks: 15 )
Write a program that will create a class distance. The class distance consist of two data
members feet and inches, both of types float. The class distance consist of two member
functions, getdata() and show(). The function getdata() is used to read data from the
user through keyboard into feet and inches. The show() function is used to display the
values of feet and inches on the screen.
The program will create two objects dest1 and dest2 of the class distance. The program
will read data into dest1 and dest2 using getdata(). The program will create another
object dest3 of the class distance by overloading the minus “-“operator trough
expression dest3=dest1-dest2. The program will then display dist3 on the screen using
show() function. The program also takes care of the fact that distance can not be
negative. If dest2 is larger then dest1 then dest3 should not be created and program
should display the message “Distance can not be negative”.
Question No: 9
( Marks: 8 )
What are the benefits of the templates?