Programming fundamentals using c++ question paper 2014 tutorialsduniya

TutorialsDuniya.com
TutorialsDuniya.comTutorialsDuniya.com

Programming fundamentals using c++ question paper 2014 tutorialsduniya

-.
[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

Recomendados

Electronic devices-9 e-floyd-solutions por
Electronic devices-9 e-floyd-solutionsElectronic devices-9 e-floyd-solutions
Electronic devices-9 e-floyd-solutionsEhtishamRaza1
59.8K vistas164 diapositivas
Pak US relations por
Pak US relationsPak US relations
Pak US relationsAreej Fatima
19.8K vistas22 diapositivas
Causes and removal of industrial backwardness in pakistan por
Causes and removal of industrial backwardness in pakistanCauses and removal of industrial backwardness in pakistan
Causes and removal of industrial backwardness in pakistannight seem
27.8K vistas19 diapositivas
Pakistan-US relations por
Pakistan-US relationsPakistan-US relations
Pakistan-US relationsSaad Afridi
71.8K vistas53 diapositivas
Nuclear arms race between india and pakistan rises por
Nuclear arms race between india and pakistan risesNuclear arms race between india and pakistan rises
Nuclear arms race between india and pakistan risesafaidiana
3K vistas12 diapositivas
Clash of civilizations por
Clash of civilizationsClash of civilizations
Clash of civilizationsAima Buttar
19K vistas15 diapositivas

Más contenido relacionado

La actualidad más candente

Domestic Issues of Pakistan por
Domestic Issues of PakistanDomestic Issues of Pakistan
Domestic Issues of PakistanAamir Habib Khattak
2.2K vistas23 diapositivas
Diplomacy por
DiplomacyDiplomacy
DiplomacyMa E.C.C.
359 vistas9 diapositivas
Synchronous Loadable Up and Down Counter por
Synchronous Loadable Up and Down Counter Synchronous Loadable Up and Down Counter
Synchronous Loadable Up and Down Counter Digital System Design
5.2K vistas13 diapositivas
Latch & Flip-Flop Design.pptx por
Latch & Flip-Flop Design.pptxLatch & Flip-Flop Design.pptx
Latch & Flip-Flop Design.pptxGargiKhanna2
178 vistas44 diapositivas
Pak us ties por
Pak us tiesPak us ties
Pak us tiesFakiha Rizvi
4.1K vistas37 diapositivas

La actualidad más candente(20)

Diplomacy por Ma E.C.C.
DiplomacyDiplomacy
Diplomacy
Ma E.C.C.359 vistas
Latch & Flip-Flop Design.pptx por GargiKhanna2
Latch & Flip-Flop Design.pptxLatch & Flip-Flop Design.pptx
Latch & Flip-Flop Design.pptx
GargiKhanna2178 vistas
political history of pakistan 1947-1958 por Malik Abdul Wahab
political history of pakistan 1947-1958political history of pakistan 1947-1958
political history of pakistan 1947-1958
Malik Abdul Wahab77.4K vistas
Pakistan in international organization por Annumchaudhary
Pakistan in international organizationPakistan in international organization
Pakistan in international organization
Annumchaudhary30.2K vistas
National security of pakistan por Tallat Satti
National security of pakistan National security of pakistan
National security of pakistan
Tallat Satti14.2K vistas
Initial problem of pakistan por falak nawaz
Initial problem of pakistanInitial problem of pakistan
Initial problem of pakistan
falak nawaz235.7K vistas
China Pakistan Friendship and CPEC por Zeeshan Akhtar
China Pakistan Friendship and CPEC China Pakistan Friendship and CPEC
China Pakistan Friendship and CPEC
Zeeshan Akhtar6.8K vistas
Data representation and Arithmetic Algorithms por Mumthas Shaikh
Data representation and Arithmetic AlgorithmsData representation and Arithmetic Algorithms
Data representation and Arithmetic Algorithms
Mumthas Shaikh2.1K vistas
Technical reports Exam 2014 por Magdi Saadawi
Technical reports Exam 2014 Technical reports Exam 2014
Technical reports Exam 2014
Magdi Saadawi5.5K vistas
Pak Afghan Relation por ShArear Roy
Pak Afghan RelationPak Afghan Relation
Pak Afghan Relation
ShArear Roy12.7K vistas
Economic Development of Pakistan por Ali Ali
Economic Development of PakistanEconomic Development of Pakistan
Economic Development of Pakistan
Ali Ali11.8K vistas

Similar a Programming fundamentals using c++ question paper 2014 tutorialsduniya

Fic (sendup dec17) cs lb por
Fic (sendup dec17) cs lbFic (sendup dec17) cs lb
Fic (sendup dec17) cs lbFazaia inter college lahore
51 vistas6 diapositivas
Fic (sendup dec17) cs lb por
Fic (sendup dec17) cs lbFic (sendup dec17) cs lb
Fic (sendup dec17) cs lbFazaia inter college lahore
94 vistas6 diapositivas
2nd Opinion The role of the preprocessor in the.pdf por
2nd Opinion The role of the preprocessor in the.pdf2nd Opinion The role of the preprocessor in the.pdf
2nd Opinion The role of the preprocessor in the.pdfbkbk37
3 vistas2 diapositivas
2nd Opinion The role of the preprocessor in the.pdf por
2nd Opinion The role of the preprocessor in the.pdf2nd Opinion The role of the preprocessor in the.pdf
2nd Opinion The role of the preprocessor in the.pdfbkbk37
3 vistas2 diapositivas
2nd Opinion The role of the preprocessor in the.pdf por
2nd Opinion The role of the preprocessor in the.pdf2nd Opinion The role of the preprocessor in the.pdf
2nd Opinion The role of the preprocessor in the.pdfscottharry3
4 vistas2 diapositivas
Computer Science Sample Paper 2 por
Computer Science Sample Paper 2Computer Science Sample Paper 2
Computer Science Sample Paper 2kvs
519 vistas16 diapositivas

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

2nd Opinion The role of the preprocessor in the.pdf por bkbk37
2nd Opinion The role of the preprocessor in the.pdf2nd Opinion The role of the preprocessor in the.pdf
2nd Opinion The role of the preprocessor in the.pdf
bkbk373 vistas
2nd Opinion The role of the preprocessor in the.pdf por bkbk37
2nd Opinion The role of the preprocessor in the.pdf2nd Opinion The role of the preprocessor in the.pdf
2nd Opinion The role of the preprocessor in the.pdf
bkbk373 vistas
2nd Opinion The role of the preprocessor in the.pdf por scottharry3
2nd Opinion The role of the preprocessor in the.pdf2nd Opinion The role of the preprocessor in the.pdf
2nd Opinion The role of the preprocessor in the.pdf
scottharry34 vistas
Computer Science Sample Paper 2 por kvs
Computer Science Sample Paper 2Computer Science Sample Paper 2
Computer Science Sample Paper 2
kvs519 vistas
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx por alfred4lewis58146
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docxPage 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx
Sem 1 bscit summer 2014 solved assignments por smumbahelp
Sem 1 bscit summer 2014 solved assignmentsSem 1 bscit summer 2014 solved assignments
Sem 1 bscit summer 2014 solved assignments
smumbahelp326 vistas
Problem solving technique &amp; programming in c code 303204 bca 2nd... por umesh singh
Problem solving technique &amp; programming in c   code  303204   bca     2nd...Problem solving technique &amp; programming in c   code  303204   bca     2nd...
Problem solving technique &amp; programming in c code 303204 bca 2nd...
umesh singh248 vistas
CS Sample Paper 1 por kvs
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1
kvs2.2K vistas
Part I File IO, URL IO, Dictionaries and other Data Structures in.pdf por pristiegee
Part I File IO, URL IO, Dictionaries and other Data Structures in.pdfPart I File IO, URL IO, Dictionaries and other Data Structures in.pdf
Part I File IO, URL IO, Dictionaries and other Data Structures in.pdf
pristiegee2 vistas
Model questions-b.sc .csit-6th-sem por NayanBakhadyo
Model questions-b.sc .csit-6th-semModel questions-b.sc .csit-6th-sem
Model questions-b.sc .csit-6th-sem
NayanBakhadyo68 vistas
Cs141 mid termexam v1 por Fahadaio
Cs141 mid termexam v1Cs141 mid termexam v1
Cs141 mid termexam v1
Fahadaio15 vistas
Gsp 125 Education Organization -- snaptutorial.com por DavisMurphyB85
Gsp 125   Education Organization -- snaptutorial.comGsp 125   Education Organization -- snaptutorial.com
Gsp 125 Education Organization -- snaptutorial.com
DavisMurphyB8512 vistas
GSP 125 Effective Communication/tutorialrank.com por jonhson282
 GSP 125 Effective Communication/tutorialrank.com GSP 125 Effective Communication/tutorialrank.com
GSP 125 Effective Communication/tutorialrank.com
jonhson28219 vistas
GSP 125 Enhance teaching/tutorialrank.com por jonhson300
 GSP 125 Enhance teaching/tutorialrank.com GSP 125 Enhance teaching/tutorialrank.com
GSP 125 Enhance teaching/tutorialrank.com
jonhson3009 vistas
GSP 125 Enhance teaching - snaptutorial.com por DavisMurphyA81
GSP 125   Enhance teaching - snaptutorial.comGSP 125   Enhance teaching - snaptutorial.com
GSP 125 Enhance teaching - snaptutorial.com
DavisMurphyA8117 vistas

Más de TutorialsDuniya.com

Ba programme globalization notes Sartaz Sir Notes por
Ba programme globalization notes Sartaz Sir NotesBa programme globalization notes Sartaz Sir Notes
Ba programme globalization notes Sartaz Sir NotesTutorialsDuniya.com
2K vistas23 diapositivas
Ba programme english notes Sartaz Sir Notes por
Ba programme english notes Sartaz Sir NotesBa programme english notes Sartaz Sir Notes
Ba programme english notes Sartaz Sir NotesTutorialsDuniya.com
692 vistas36 diapositivas
DU BA programme education notes Sartaz Sir Notes por
DU BA programme education notes Sartaz Sir NotesDU BA programme education notes Sartaz Sir Notes
DU BA programme education notes Sartaz Sir NotesTutorialsDuniya.com
198 vistas40 diapositivas
Ba programme political science notes Sartaz Sir Notes por
Ba programme political science notes Sartaz Sir NotesBa programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir NotesTutorialsDuniya.com
453 vistas21 diapositivas
Ba programme history notes Sartaz Sir Notes por
Ba programme history notes Sartaz Sir NotesBa programme history notes Sartaz Sir Notes
Ba programme history notes Sartaz Sir NotesTutorialsDuniya.com
465 vistas39 diapositivas
Ba programme hindi notes Sartaz Sir Notes por
Ba programme hindi notes Sartaz Sir NotesBa programme hindi notes Sartaz Sir Notes
Ba programme hindi notes Sartaz Sir NotesTutorialsDuniya.com
261 vistas18 diapositivas

Más de TutorialsDuniya.com(20)

DU BA programme education notes Sartaz Sir Notes por TutorialsDuniya.com
DU BA programme education notes Sartaz Sir NotesDU BA programme education notes Sartaz Sir Notes
DU BA programme education notes Sartaz Sir Notes
TutorialsDuniya.com198 vistas
Ba programme political science notes Sartaz Sir Notes por TutorialsDuniya.com
Ba programme political science notes Sartaz Sir NotesBa programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com453 vistas
Ba programme political science notes Sartaz Sir Notes por TutorialsDuniya.com
Ba programme political science notes Sartaz Sir NotesBa programme political science notes Sartaz Sir Notes
Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com756 vistas
DU Ba programme political science notes Sartaz Sir Notes por TutorialsDuniya.com
DU Ba programme political science notes Sartaz Sir NotesDU Ba programme political science notes Sartaz Sir Notes
DU Ba programme political science notes Sartaz Sir Notes
TutorialsDuniya.com114 vistas

Último

GDSC Mikroskil Members Onboarding 2023.pdf por
GDSC Mikroskil Members Onboarding 2023.pdfGDSC Mikroskil Members Onboarding 2023.pdf
GDSC Mikroskil Members Onboarding 2023.pdfgdscmikroskil
68 vistas62 diapositivas
sam_software_eng_cv.pdf por
sam_software_eng_cv.pdfsam_software_eng_cv.pdf
sam_software_eng_cv.pdfsammyigbinovia
11 vistas5 diapositivas
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf por
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdfASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdfAlhamduKure
10 vistas11 diapositivas
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx por
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptxlwang78
188 vistas19 diapositivas
unit 1.pptx por
unit 1.pptxunit 1.pptx
unit 1.pptxrrbornarecm
5 vistas53 diapositivas
Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R... por
Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R...Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R...
Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R...IJCNCJournal
5 vistas25 diapositivas

Último(20)

GDSC Mikroskil Members Onboarding 2023.pdf por gdscmikroskil
GDSC Mikroskil Members Onboarding 2023.pdfGDSC Mikroskil Members Onboarding 2023.pdf
GDSC Mikroskil Members Onboarding 2023.pdf
gdscmikroskil68 vistas
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf por AlhamduKure
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdfASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf
ASSIGNMENTS ON FUZZY LOGIC IN TRAFFIC FLOW.pdf
AlhamduKure10 vistas
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx por lwang78
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx
lwang78188 vistas
Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R... por IJCNCJournal
Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R...Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R...
Trust Metric-Based Anomaly Detection via Deep Deterministic Policy Gradient R...
IJCNCJournal5 vistas
Programmable Logic Devices : SPLD and CPLD por Usha Mehta
Programmable Logic Devices : SPLD and CPLDProgrammable Logic Devices : SPLD and CPLD
Programmable Logic Devices : SPLD and CPLD
Usha Mehta8 vistas
MongoDB.pdf por ArthyR3
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
ArthyR351 vistas
BCIC - Manufacturing Conclave - Technology-Driven Manufacturing for Growth por Innomantra
BCIC - Manufacturing Conclave -  Technology-Driven Manufacturing for GrowthBCIC - Manufacturing Conclave -  Technology-Driven Manufacturing for Growth
BCIC - Manufacturing Conclave - Technology-Driven Manufacturing for Growth
Innomantra 20 vistas
Unlocking Research Visibility.pdf por KhatirNaima
Unlocking Research Visibility.pdfUnlocking Research Visibility.pdf
Unlocking Research Visibility.pdf
KhatirNaima11 vistas
Field Programmable Gate Arrays : Architecture por Usha Mehta
Field Programmable Gate Arrays : ArchitectureField Programmable Gate Arrays : Architecture
Field Programmable Gate Arrays : Architecture
Usha Mehta9 vistas
taylor-2005-classical-mechanics.pdf por ArturoArreola10
taylor-2005-classical-mechanics.pdftaylor-2005-classical-mechanics.pdf
taylor-2005-classical-mechanics.pdf
ArturoArreola1029 vistas
Design_Discover_Develop_Campaign.pptx por ShivanshSeth6
Design_Discover_Develop_Campaign.pptxDesign_Discover_Develop_Campaign.pptx
Design_Discover_Develop_Campaign.pptx
ShivanshSeth655 vistas
Integrating Sustainable Development Goals (SDGs) in School Education por SheetalTank1
Integrating Sustainable Development Goals (SDGs) in School EducationIntegrating Sustainable Development Goals (SDGs) in School Education
Integrating Sustainable Development Goals (SDGs) in School Education
SheetalTank111 vistas
Basic Design Flow for Field Programmable Gate Arrays por Usha Mehta
Basic Design Flow for Field Programmable Gate ArraysBasic Design Flow for Field Programmable Gate Arrays
Basic Design Flow for Field Programmable Gate Arrays
Usha Mehta5 vistas
AWS Certified Solutions Architect Associate Exam Guide_published .pdf por Kiran Kumar Malik
AWS Certified Solutions Architect Associate Exam Guide_published .pdfAWS Certified Solutions Architect Associate Exam Guide_published .pdf
AWS Certified Solutions Architect Associate Exam Guide_published .pdf

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 help@tutorialsduniya.com
  • 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 help@tutorialsduniya.com
  • 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 help@tutorialsduniya.com
  • 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 help@tutorialsduniya.com
  • 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 help@tutorialsduniya.com
  • 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 help@tutorialsduniya.com
  • 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