P. G. D. C. M. (Semester - I),University Of Pune Question Paper,2010 Question Paper,INTRODUCTION TO C++ AND C++ LANGUAGE,

University Of Pune Question Paper
P. G. D. C. M. (Semester - I) Examination - 2010
INTRODUCTION TO C++ AND C++ LANGUAGE
(2008 Pattern)
Time : 3 Hours] [Max. Marks : 70
Instructions :
(1) Question Nos. 1 and 7 are compulsory.
(2) Write any four from Q. Nos. 2 to 6.
Q.1) Consider the following programs and explain what will be the output : [15]
(a) class Item{
int itemId;
public;
void print(int);
};
void Item::print(int id){
itemId = id;
cout<<itemId;
}
void main( ){
Item itm;
int id;
cin>>id;
itm.itemId = id;
cout<<itm.itemId;
itm.print(id);
(b) void main( ){
char name[5];
name[0] = ‘N’;
name[1] = ‘I’;
name[2] = ‘T’;
name[3] = ‘\0’;
name[4] = ‘I’;
name[5] = ‘N’;
puts(name);
}
(c) void main( ){
int numb = 23;
int val1, val2;
val1 = numb<<3;
val2 = val1>>4;
printf(“%d%d”, val1, val2);
}
(d) void main( ){
for(int i = 0, i<=5; i++)
{
for(int j = i; j < = 5; j++);
cout<<j<<endl;
}
}
(e) int i = 11;
void main( ){
int i = 25;
cout<<“i”<<i<<endl;
i = 55;
cout<<“i”<<::i;
}
Q.2) Write a C program that will accept 10 numbers in array and will print
array in ascending order. [10]
Q.3) Write a C function that will accept a number from user and print
binary equivalent of that number. [10]
Q.4) Write a C++ program that will accept number from user and check
whether number is prime or not using recursive function. [10]
Q.5) Design a class with the following specifications :
(Empid, empsal as private member variables and calculatesal as private
member function, empname, empaddress as public member variables
and printData as public function.) [10]
Q.6) Write a C++ program to store and print 50 student records in the
following structure : [10]
Student (name, rollno, marks for 3 subjects)
Q.7) Write short notes : (Any Three) [15]
(a) Operators used in C++
(b) Inline and Friend Functions in C++ with example
(c) Loops in C
(d) Storage Classes in C
(e) Manipulators in C++