SlideShare a Scribd company logo
2
Most read
4
Most read
5
Most read
-.
[This question paper contains 6 printed pages.]
Sr. No. ofQuestion Paper 6065 D Your Roll No................
Unique Paper Code 2341011251305
Narne of the Course B.Sc. (Hons.) Computer Science I B.Sc. (Hons.) Electronics
Name of the Paper Fundamental of Programming
Semester I I III
Duration : 3 Hours Maximum Marks: 75
Instructions for Candidates
1. Write your Roll No. on the top immediately on receipt of this question paper.
2. There are two parts in the Question Paper.
3. Parts of a Question should be attempted together.
4. Part I : All its questions are compulsory.
5. Part II : Attempt any four questions.
PART I
Question No. 1 is compulsory.
Parts of the question should be attempted together.
1. (a) How.is (-5)10
represented in 2's complement form using 6 bits? (4)
(b) Differentiate between the following :
(i) Runtime polymorphism and compile time polymorphism
(ii) Call by value and call by reference
(iii) Public and private access type.
(c) Give output of the following code segments :
(6)
(i) If x=O, y=O, and z=1, what are the values of x, y, and z after executing
the following code ? (3)
PT.O.
TutorialsD
uniya.com
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
6065 2
if(z < x II y >= z && z == 1)
if(z && y)
y= 1;
else
x= 1;
(ii) string strl ("DU University");
string str2 ("DU Union");
int result;
result= strl.compare(str2);
cout <<result;
result = strl.compare(O, 6, str2);
cout << result;
(iii) int a=15·int b=9·int c·
' ' '
int* p = &b; int* q;
int* r;
q=p;
r=&c;
p=&a;
*q=8;
*r=*p;
*r=a+*q+*&c;
cout <<*p<<" " << *q << " " << *r <<endl;
(iv) int i;
int list[10] = {2, 1, 2, 4, 1, 2, 0, 2, 1, 2};
int res [10];
for(i=O;i<1O;i++)
res[i]=list[9-i];
for(i=O;i< 1O;i++)
cout <<res[i]<<" ";
(4)
"'.-
(3)
(5)
TutorialsD
uniya.com
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
J
6065 3
(d) If four objects of a class are defined, how many copies of class data items
are stored in the memory and how many copies of its functions ? (2)
(e) What are friend functions? What are their advantages?
(f) Find errors in the following code segment :
(i) int main()
{ int i=5;
while(i)
{ switch(i)
{
}
i--·
'
}
}
(ii) #include<iostream>
using namespace std;
intmain()
{
int i = 0;
i=i+1;
cout << i << " ";
default:
case 4:
case 5:
case 1:
break;
continue;
case 2:
case 3:
break;
/* comment*//i = i + 1;
cout << i;
}
(4)
(2)
(2)
P.TO.
TutorialsD
uniya.com
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
- - - - - - - - - - - - - - - - - -
6065 4
PART II
Attempt any four questions.
2. (a) We have two arrays A and B, each of 10 integers. Write a function that tests
if every element of array A is equal to its corresponding element in arrays
B. In other words, the function must check ifA[O] is equal to B[O], A[1] is
equal to B[ 1], and so forth. (5)
(b) What are the static members of a class ? What are the restrictions on static
function members ? (5)
3. (a) If originally x = 3 andy= 5, what are the values of x andy after evaluation
of each of the following expressions ?
(i) x++ + y
(ii) ++x + 2 (4)
(b) What do you understand by function overloading ? How is it different from
function overriding? Give an example of function overloading. (6)
4. (a) Write a C++ program to count occurrences of character 'a' and ' A' in a
given string. (5)
(b) Write a function which returns the number of times an element occurs in an
array. The array and the element to be searched are passed as arguments to
the functions. (5)
5. (a) Differentiate between binary files and text files in C++. (4)
(b) What is copy constructor? Explain with example. (4)
(c) Rewrite the following code fragment using a switch statement: (2)
if(ch == 'E' II ch == 'e')
countE++;
TutorialsD
uniya.com
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
6065 5
elseif(ch =='A' II ch =='a')
countA++;
elseif(ch =='I' II ch == 'i')
count!++;
else
cout << "Error- Not A, E, or I n";
6. (a) Create a class TwoDim which contains x andy coordinates as int. Define the
default constructor, parameterized constructor and void print() to print the
co-ordinates. Now reuse this class in ThreeDim adding a new dimension as
z of type int. Define the constructors for the derived class artd override the
method void print() in the subclass. Write main() to show runtime
polymorphism.
(b) Write a C++ statement for the following expression :
c = ~a2
+ b
2
- 2ab
(8)
(2)
7. (a) Consider the following class definition. What data members and functions
are directly accessible by the functions readit(), inform(), and B(). (3)
void inform(void);
class X
{
} ;
int a;
float b;
void init(void);
public:
char ch;
char gett(void);
protected:
double amt;
void getamt(void);
friend void A(void);
PT.O.
-__r
TutorialsD
uniya.com
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
I
~.
6065
class Y: public X
{
};
int x;
public:
intj;
void read(void);
protected:
void info(void);
friend void B(void);
6
(b) Find the error(s) in the following code segment:
class x {............. };
classy {............. };
class z {.............};
void alpha() throw(x,y)
{
throw z();
}
(2)
(c) What is the sequence of constructors and destructors being called in a
multilevel inheritance where class A is parent class of class B, class C is
derived class of ~lass B, class D is derived class of class C ? (5)
(1300)
TutorialsD
uniya.com
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc.
For any query, contact us at help@tutorialsduniya.com
TUTORIALSDUNIYA.COM
Get FREE Compiled Books, Notes, Programs, Question Papers with Solution
etc of the following subjects at https://www.tutorialsduniya.com
 C and C++  Computer System Architecture
 Java  Discrete Structures
 Data Structures  Operating Systems
 Computer Networks  Algorithms
 Android Programming  DataBase Management Systems
 PHP Programming  Software Engineering
 JavaScript  Theory of Computation
 Java Server Pages  Operational Research
 Python  System Programming
 Microprocessor  Data Mining
 Artificial Intelligence  Computer Graphics
 Machine Learning  Data Science
DU Programs: https://www.tutorialsduniya.com/programs
TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp
C++ Tutorial: https://www.tutorialsduniya.com/cplusplus
Java Tutorial: https://www.tutorialsduniya.com/java
JavaScript Tutorial: https://www.tutorialsduniya.com/javascript
Python Tutorial: https://www.tutorialsduniya.com/python
Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin
JSP Tutorial: https://www.tutorialsduniya.com/jsp

More Related Content

What's hot (20)

PPTX
Searching techniques in Data Structure And Algorithm
03446940736
 
PDF
Object Oriented Programming Lecture Notes
FellowBuddy.com
 
PPTX
Object Oriented Programming
Iqra khalil
 
PPTX
Looping statements in C
Jeya Lakshmi
 
PPT
Java tutorial PPT
Intelligo Technologies
 
PPT
15. Transactions in DBMS
koolkampus
 
PPTX
Selected topics in Computer Science
Melaku Bayih Demessie
 
PPTX
Presentation on queue
Rojan Pariyar
 
PDF
Arrays In Python | Python Array Operations | Edureka
Edureka!
 
PPTX
Python Exception Handling
Megha V
 
PDF
Control Structures in Python
Sumit Satam
 
PDF
Object oriented programming c++
Ankur Pandey
 
PPTX
Python-DataAbstarction.pptx
Karudaiyar Ganapathy
 
PPTX
System calls
Bernard Senam
 
PDF
Introduction to c++ ppt 1
Prof. Dr. K. Adisesha
 
PPTX
Process scheduling
Riya Choudhary
 
PPTX
heap Sort Algorithm
Lemia Algmri
 
PPTX
Exception handling
PhD Research Scholar
 
PPTX
Functions in c++
Rokonuzzaman Rony
 
PDF
Object Oriented Programming Using C++ Practical File
Harjinder Singh
 
Searching techniques in Data Structure And Algorithm
03446940736
 
Object Oriented Programming Lecture Notes
FellowBuddy.com
 
Object Oriented Programming
Iqra khalil
 
Looping statements in C
Jeya Lakshmi
 
Java tutorial PPT
Intelligo Technologies
 
15. Transactions in DBMS
koolkampus
 
Selected topics in Computer Science
Melaku Bayih Demessie
 
Presentation on queue
Rojan Pariyar
 
Arrays In Python | Python Array Operations | Edureka
Edureka!
 
Python Exception Handling
Megha V
 
Control Structures in Python
Sumit Satam
 
Object oriented programming c++
Ankur Pandey
 
Python-DataAbstarction.pptx
Karudaiyar Ganapathy
 
System calls
Bernard Senam
 
Introduction to c++ ppt 1
Prof. Dr. K. Adisesha
 
Process scheduling
Riya Choudhary
 
heap Sort Algorithm
Lemia Algmri
 
Exception handling
PhD Research Scholar
 
Functions in c++
Rokonuzzaman Rony
 
Object Oriented Programming Using C++ Practical File
Harjinder Singh
 

Similar to Programming fundamentals using c++ question paper 2014 tutorialsduniya (20)

PDF
Data Structure and Algorithm
PRIYA DARSHINI A/P VEJAN
 
PDF
2014 computer science_question_paper
vandna123
 
PPTX
Data types
Nokesh Prabhakar
 
PDF
C++ normal assignments by maharshi_jd.pdf
maharshi1731
 
PDF
computer science sample papers 2
Swarup Kumar Boro
 
PDF
Ds lab handouts
Ayesha Bhatti
 
DOCX
GSP 125 Entire Course NEW
shyamuopten
 
PDF
CBSE Question Paper Computer Science with C++ 2011
Deepak Singh
 
PPT
C++ data types
pratikborsadiya
 
RTF
CBSE Grade12, Computer Science, Sample Question Paper
Malathi Senthil
 
PDF
Solutions for Exercises – Data Structures and Algorithms in C++ (2nd Edition)...
maryarchitect25
 
PDF
Fun with Lambdas: C++14 Style (part 1)
Sumant Tambe
 
PDF
09 a1ec01 c programming and data structures
jntuworld
 
PDF
C++ How to Program 10th Edition Deitel Solutions Manual
leletydanni
 
DOC
Sp 1418794917
lakshmi r
 
PDF
Computer Science Sample Paper 2015
Poonam Chopra
 
PDF
Ch 4
AMIT JAIN
 
PDF
Computer Science Sample Paper 2
kvs
 
PPTX
CPP Homework Help
C++ Homework Help
 
DOC
Pads lab manual final
AhalyaR
 
Data Structure and Algorithm
PRIYA DARSHINI A/P VEJAN
 
2014 computer science_question_paper
vandna123
 
Data types
Nokesh Prabhakar
 
C++ normal assignments by maharshi_jd.pdf
maharshi1731
 
computer science sample papers 2
Swarup Kumar Boro
 
Ds lab handouts
Ayesha Bhatti
 
GSP 125 Entire Course NEW
shyamuopten
 
CBSE Question Paper Computer Science with C++ 2011
Deepak Singh
 
C++ data types
pratikborsadiya
 
CBSE Grade12, Computer Science, Sample Question Paper
Malathi Senthil
 
Solutions for Exercises – Data Structures and Algorithms in C++ (2nd Edition)...
maryarchitect25
 
Fun with Lambdas: C++14 Style (part 1)
Sumant Tambe
 
09 a1ec01 c programming and data structures
jntuworld
 
C++ How to Program 10th Edition Deitel Solutions Manual
leletydanni
 
Sp 1418794917
lakshmi r
 
Computer Science Sample Paper 2015
Poonam Chopra
 
Ch 4
AMIT JAIN
 
Computer Science Sample Paper 2
kvs
 
CPP Homework Help
C++ Homework Help
 
Pads lab manual final
AhalyaR
 
Ad

More from TutorialsDuniya.com (20)

PDF
Ba programme globalization notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme english notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
DU BA programme education notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme history notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme hindi notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme economics notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme human rights notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme history notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme hindi notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
BA programme education notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Ba programme english notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
DU Ba programme education notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
DU Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
DU Ba programme hindi notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
DU Ba programme english notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
DU Ba programme history notes Sartaz Sir Notes
TutorialsDuniya.com
 
PDF
Computer graphics notes 4 tutorials duniya
TutorialsDuniya.com
 
PDF
C++ notes 2 tutorials duniya
TutorialsDuniya.com
 
Ba programme globalization notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme english notes Sartaz Sir Notes
TutorialsDuniya.com
 
DU BA programme education notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme history notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme hindi notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme economics notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme human rights notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme history notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme hindi notes Sartaz Sir Notes
TutorialsDuniya.com
 
BA programme education notes Sartaz Sir Notes
TutorialsDuniya.com
 
Ba programme english notes Sartaz Sir Notes
TutorialsDuniya.com
 
DU Ba programme education notes Sartaz Sir Notes
TutorialsDuniya.com
 
DU Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com
 
DU Ba programme hindi notes Sartaz Sir Notes
TutorialsDuniya.com
 
DU Ba programme english notes Sartaz Sir Notes
TutorialsDuniya.com
 
DU Ba programme history notes Sartaz Sir Notes
TutorialsDuniya.com
 
Computer graphics notes 4 tutorials duniya
TutorialsDuniya.com
 
C++ notes 2 tutorials duniya
TutorialsDuniya.com
 
Ad

Recently uploaded (20)

PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PDF
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Day2 B2 Best.pptx
helenjenefa1
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 

Programming fundamentals using c++ question paper 2014 tutorialsduniya

  • 1. -. [This question paper contains 6 printed pages.] Sr. No. ofQuestion Paper 6065 D Your Roll No................ Unique Paper Code 2341011251305 Narne of the Course B.Sc. (Hons.) Computer Science I B.Sc. (Hons.) Electronics Name of the Paper Fundamental of Programming Semester I I III Duration : 3 Hours Maximum Marks: 75 Instructions for Candidates 1. Write your Roll No. on the top immediately on receipt of this question paper. 2. There are two parts in the Question Paper. 3. Parts of a Question should be attempted together. 4. Part I : All its questions are compulsory. 5. Part II : Attempt any four questions. PART I Question No. 1 is compulsory. Parts of the question should be attempted together. 1. (a) How.is (-5)10 represented in 2's complement form using 6 bits? (4) (b) Differentiate between the following : (i) Runtime polymorphism and compile time polymorphism (ii) Call by value and call by reference (iii) Public and private access type. (c) Give output of the following code segments : (6) (i) If x=O, y=O, and z=1, what are the values of x, y, and z after executing the following code ? (3) PT.O. TutorialsD uniya.com Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. For any query, contact us at [email protected]
  • 2. 6065 2 if(z < x II y >= z && z == 1) if(z && y) y= 1; else x= 1; (ii) string strl ("DU University"); string str2 ("DU Union"); int result; result= strl.compare(str2); cout <<result; result = strl.compare(O, 6, str2); cout << result; (iii) int a=15·int b=9·int c· ' ' ' int* p = &b; int* q; int* r; q=p; r=&c; p=&a; *q=8; *r=*p; *r=a+*q+*&c; cout <<*p<<" " << *q << " " << *r <<endl; (iv) int i; int list[10] = {2, 1, 2, 4, 1, 2, 0, 2, 1, 2}; int res [10]; for(i=O;i<1O;i++) res[i]=list[9-i]; for(i=O;i< 1O;i++) cout <<res[i]<<" "; (4) "'.- (3) (5) TutorialsD uniya.com Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at [email protected]
  • 3. J 6065 3 (d) If four objects of a class are defined, how many copies of class data items are stored in the memory and how many copies of its functions ? (2) (e) What are friend functions? What are their advantages? (f) Find errors in the following code segment : (i) int main() { int i=5; while(i) { switch(i) { } i--· ' } } (ii) #include<iostream> using namespace std; intmain() { int i = 0; i=i+1; cout << i << " "; default: case 4: case 5: case 1: break; continue; case 2: case 3: break; /* comment*//i = i + 1; cout << i; } (4) (2) (2) P.TO. TutorialsD uniya.com Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. For any query, contact us at [email protected]
  • 4. - - - - - - - - - - - - - - - - - - 6065 4 PART II Attempt any four questions. 2. (a) We have two arrays A and B, each of 10 integers. Write a function that tests if every element of array A is equal to its corresponding element in arrays B. In other words, the function must check ifA[O] is equal to B[O], A[1] is equal to B[ 1], and so forth. (5) (b) What are the static members of a class ? What are the restrictions on static function members ? (5) 3. (a) If originally x = 3 andy= 5, what are the values of x andy after evaluation of each of the following expressions ? (i) x++ + y (ii) ++x + 2 (4) (b) What do you understand by function overloading ? How is it different from function overriding? Give an example of function overloading. (6) 4. (a) Write a C++ program to count occurrences of character 'a' and ' A' in a given string. (5) (b) Write a function which returns the number of times an element occurs in an array. The array and the element to be searched are passed as arguments to the functions. (5) 5. (a) Differentiate between binary files and text files in C++. (4) (b) What is copy constructor? Explain with example. (4) (c) Rewrite the following code fragment using a switch statement: (2) if(ch == 'E' II ch == 'e') countE++; TutorialsD uniya.com Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at [email protected]
  • 5. 6065 5 elseif(ch =='A' II ch =='a') countA++; elseif(ch =='I' II ch == 'i') count!++; else cout << "Error- Not A, E, or I n"; 6. (a) Create a class TwoDim which contains x andy coordinates as int. Define the default constructor, parameterized constructor and void print() to print the co-ordinates. Now reuse this class in ThreeDim adding a new dimension as z of type int. Define the constructors for the derived class artd override the method void print() in the subclass. Write main() to show runtime polymorphism. (b) Write a C++ statement for the following expression : c = ~a2 + b 2 - 2ab (8) (2) 7. (a) Consider the following class definition. What data members and functions are directly accessible by the functions readit(), inform(), and B(). (3) void inform(void); class X { } ; int a; float b; void init(void); public: char ch; char gett(void); protected: double amt; void getamt(void); friend void A(void); PT.O. -__r TutorialsD uniya.com Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com for Notes, books, programs, question papers with solutions etc. For any query, contact us at [email protected]
  • 6. I ~. 6065 class Y: public X { }; int x; public: intj; void read(void); protected: void info(void); friend void B(void); 6 (b) Find the error(s) in the following code segment: class x {............. }; classy {............. }; class z {.............}; void alpha() throw(x,y) { throw z(); } (2) (c) What is the sequence of constructors and destructors being called in a multilevel inheritance where class A is parent class of class B, class C is derived class of ~lass B, class D is derived class of class C ? (5) (1300) TutorialsD uniya.com Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. Visit https://www.tutorialsduniya.com forNotes, books, programs, question papers with solutions etc. For any query, contact us at [email protected]
  • 7. TUTORIALSDUNIYA.COM Get FREE Compiled Books, Notes, Programs, Question Papers with Solution etc of the following subjects at https://www.tutorialsduniya.com  C and C++  Computer System Architecture  Java  Discrete Structures  Data Structures  Operating Systems  Computer Networks  Algorithms  Android Programming  DataBase Management Systems  PHP Programming  Software Engineering  JavaScript  Theory of Computation  Java Server Pages  Operational Research  Python  System Programming  Microprocessor  Data Mining  Artificial Intelligence  Computer Graphics  Machine Learning  Data Science DU Programs: https://www.tutorialsduniya.com/programs TutorialsDuniya App: http://bit.ly/TutorialsDuniyaApp C++ Tutorial: https://www.tutorialsduniya.com/cplusplus Java Tutorial: https://www.tutorialsduniya.com/java JavaScript Tutorial: https://www.tutorialsduniya.com/javascript Python Tutorial: https://www.tutorialsduniya.com/python Kotlin Tutorial: https://www.tutorialsduniya.com/kotlin JSP Tutorial: https://www.tutorialsduniya.com/jsp