11CS EM CheckOnce
11CS EM CheckOnce
11 – COMPUTER SCIENCE
A. Prabhakar - 9442979144
Dear Students!
Congratulations.
Give your best in each exam.
Understand and read throughout the book to get full marks.
C++ programs and other programs of 5 marks will be at the end. Understand well and
read.
This has been prepared and provided on the basis of
experience and past public examination question papers.
So, …
================================================
S.No | Book Name |author
=====================================================
1 |Programming | Dromy
2 |C++programming | BjarneStroustrup
=================================================
5. Write the output of the following coding.
#include <iostream>
#include <string> Output:
using namespace std; First Student
roll no : 1
struct student
name : Brown
{ phone no : 123443
int roll_no; Second Student
char name[10]; roll no : 2
long phone_number; name : Sam
}; phone no : 1234567822
int main(){ Third Student
student p1 = {1,"Brown",123443}; roll no : 3
name : Addy
student p2, p3;
phone no : 1234567844
p2.roll_no = 2;
strcpy(p2.name ,"Sam");
p2.phone_number = 1234567822;
p3.roll_no = 3;
strcpy(p3.name,"Addy");
p3.phone_number = 1234567844;
cout<< "First Student" <<endl;
cout<< "roll no : " << p1.roll_no <<endl;
cout<< "name : " << p1.name <<endl;
cout<< "phone no : " << p1.phone_number <<endl;
cout<< "Second Student" <<endl;
cout<< "roll no : " << p2.roll_no <<endl;
cout<< "name : " << p2.name <<endl;
cout<< "phone no : " << p2.phone_number <<endl;
cout<< "Third Student" <<endl;
cout<< "roll no : " << p3.roll_no <<endl;
cout<< "name : " << p3.name <<endl;
cout<< "phone no : " << p3.phone_number <<endl;
return 0;
}
vi. Which constructor will get executed in the above program? Write the output of the program
Default constructor gets executed.
Output 1: Output 2:
Enter First String : TEXT Enter First String : TEXT
Enter Second String : BOOK Enter Second String : BOOK
Strings are not Equal Strings are not Equal
Prabhakar A (aprabhakarmca.blogspot.com)