GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare...

15
1/2 Seat No.: ________ Enrolment No.: __________ GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA ENGINEERING SEMESTER III • EXAMINATION – SUMMER 16 Subject Code: 3330702 Date: 12.05.2016 Subject Name: Programming in C++ Time: 02:30 PM TO 05:00 PM Total Marks: 70 Instructions: 1. Attempt any five questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. 4. Each question carry equal marks (14 marks) Q.1 (a) Write the important features of Procedure Oriented Programming and Object Oriented Programming 07 (b) Explain call by reference and write a program for that in C++. 07 Q.2 (a) What is inline function? How it works compare to other functions? Give the syntax and example of inline function . 07 (b) Define Class & Object . Write syntax for accessing a data member and member function of a class. Explain , how to define and access member function inside the class with example. 07 OR (b) Write a simple C++ program that show the use arrays within a class 07 Q.3 (a) What is static data member and static member function .What is constructor , list the types and properties of constructor. 07 (b) Explain the concept of copy constructor with proper example. 07 OR Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper example. 07 Q.4 (a) Define Inheritance ? List the types of Inheritance and also draw the diagram s of it. 07 (b) Write a simple C++ program that show the use of single Inheritance 07 OR Q. 4 (a) What is derived class ? Write the syntax of declaring a derived class . Explain different visibility modes . 07 (b) Write a simple C++ program that show the use of multiple Inheritance 07 Q.5 (a) What is pointer ? How to declare a pointer variable and print its value. Explain following two statements . int n=10; int *iptr=&n 07 (b) Explain the functions width() , fill() , precision() with example. 07 OR Q.5 (a) Writ a simple program that prints the address of a variable and its value 07 (b) Explain the functions get() , put() , getline() with example. 07 ************

Transcript of GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare...

Page 1: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

1/2

Seat No.: ________ Enrolment No.: __________

GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA ENGINEERING – SEMESTER – III • EXAMINATION – SUMMER 16

Subject Code: 3330702 Date: 12.05.2016

Subject Name: Programming in C++

Time: 02:30 PM TO 05:00 PM Total Marks: 70

Instructions:

1. Attempt any five questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.

4. Each question carry equal marks (14 marks)

Q.1 (a) Write the important features of Procedure Oriented Programming and Object

Oriented Programming

07

(b) Explain call by reference and write a program for that in C++. 07

Q.2 (a) What is inline function? How it works compare to other functions? Give the

syntax and example of inline function .

07

(b) Define Class & Object . Write syntax for accessing a data member and member

function of a class. Explain , how to define and access member function inside

the class with example.

07

OR

(b) Write a simple C++ program that show the use arrays within a class 07

Q.3 (a) What is static data member and static member function .What is constructor ,

list the types and properties of constructor.

07

(b) Explain the concept of copy constructor with proper example. 07

OR

Q.3 (a) What is friend function and write its syntax to declare . Explain & define

destructor .

07

(b) Explain parameterized constructor with proper example. 07

Q.4 (a) Define Inheritance ? List the types of Inheritance and also draw the diagram s

of it.

07

(b) Write a simple C++ program that show the use of single Inheritance 07

OR

Q. 4 (a) What is derived class ? Write the syntax of declaring a derived class . Explain

different visibility modes .

07

(b) Write a simple C++ program that show the use of multiple Inheritance 07

Q.5 (a) What is pointer ? How to declare a pointer variable and print its value.

Explain following two statements .

int n=10;

int *iptr=&n

07

(b) Explain the functions width() , fill() , precision() with example. 07

OR

Q.5 (a) Writ a simple program that prints the address of a variable and its value 07

(b) Explain the functions get() , put() , getline() with example. 07

************

Page 2: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

2/2

ગજુરાતી પ્રશ્ન. ૧ અ Procedure Oriented Programming and Object Oriented Programming

મહત્વની લાક્ષણિકનતાઓ લખો. ૦૭

બ Call by reference સમજાવો અને તેના માટેનો પ્રોગ્રામ C++ માાં લખો. ૦૭

પ્રશ્ન. ૨ અ Inline function શ ાં છે ? બીજા ફાંકશન ની સરખામિીમાાં તે કેવી રીતે કામ કરે

છે? Inline function ને સસિંટેક્ષ અને ઉદાહરિ આપી સમજાવો . ૦૭

બ Class & Object ની વ્યાખ્યા આપો . કલાસના data member and member

functionને એક્સેસ કરવા માટેની સસિંટેક્ષ લખો. કલાસની અંદર member function

ને કેવી રીતે ડીફાઇન અને એક્સેસ કરવા તે ઉદાહરિ આપી સમજાવો.

૦૭

અથવા

બ Arrays within a classનો ઉપયોગ બતાવતો પ્રોગ્રામ C++ માાં લખો. ૦૭

પ્રશ્ન. ૩ અ Static data member and static member function શ ાં છે ? Constructor શ ાં છે?

તેની ટાઇપસ અને પ્રોપટી લખો. ૦૭

બ Copy constructor ને ઉદાહરિ આપી સમજાવો ૦૭

અથવા

પ્રશ્ન. ૩ અ friend function શ ાં છે ? તેને ડડક્લેર કરવા માટેની સસિંટેક્ષ લખો . Destructor ને ડડફાઇન કરો અને સમજાવો.

૦૭

બ Parameterized constructor ને ઉદાહરિ આપી સમજાવો ૦૭

પ્રશ્ન. ૪ અ Inheritance શ ાં છે ?Inheritanceના પ્રકાર લખો અને તેના ડાયાગ્રામ પિ દોરો. ૦૭

બ Single Inheritance નો ઉપયોગ બતાવતો પ્રોગ્રામ C++ માાં લખો. ૦૭

અથવા

પ્રશ્ન. ૪ અ Derived class શ ાં છે ? Derived class ને ડડક્લેર કરવા માટેની સસિંટેક્ષ લખો . સવસવધ પ્રકારના visibility modes સમજાવો .

૦૭

બ Multiple Inheritance નો ઉપયોગ બતાવતો પ્રોગ્રામ C++ માાં લખો. ૦૭

પ્રશ્ન. ૫ અ Pointer શ ાં છે ? Pointer variable ને કેવી રીતે ડડક્લેર કરવામાાં આવે છે તેમજ

તેની વેલ્ય કેવી રીતે સપ્રન્ટ કરવામાાં આવે છે ? નીચેના બે સ્ટેટમેંટ સમજાવો . int n=10;

int *iptr=&n

૦૭

બ આપેલ functions width() , fill() , precision() ઉદાહરિ આપી સમજાવો ૦૭

અથવા

પ્રશ્ન. ૫ અ Address of a variable and its value સપ્રન્ટ કરવા માટેનો પ્રોગ્રામ C++ માાં લખો. ૦૭

બ આપેલ functions get() , put() , getline() ઉદાહરિ આપી સમજાવો ૦૭

************

Page 3: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

1/2

Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY Diploma Engineering - SEMESTER–III • EXAMINATION – WINTER 2013

Subject Code: 3330702 Date: 28-11-2013 Subject Name: Programming in C++ Time: 02:30 pm - 05:00 pm Total Marks: 70 Instructions:

1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. 4. English version is considered to be Authentic.

Q.1 (a) What is Object Oriented Programming? Give benefits of Object Oriented Programming.

07

(b) What is reference variable? Explain with example. 07

Q.2 (a) What is inline function? Write a program that shows use of inline function. 07 (b) Explain Function Overloading with example. 07 OR (b) Explain friend function with example and list some of the special properties of

friend function. 07

Q.3 (a) What is Constructor? Explain any one type of Constructor with example. 07 (b) Explain following with examples.

1)new operator 2) destructor 07

OR Q.3 (a) What is copy constructor? Explain with example. 07

(b) List some of the special properties of the constructor. 07

Q.4 (a) What does inheritance means in c++ ? What are different types of inheritance? Give an example of any one type of inheritance.

07

(b) Show the use of multiple inheritances with the help of proper programming example.

07

OR Q. 4 (a) Show the use of multilevel inheritances with the help of proper programming

example. 07

(b) What is virtual base class? With programming example explain it. 07

Q.5 (a) Define polymorphism and Explain Virtual functions with example. What is the difference between static & dynamic binding?

07

(b) Illustrate with an example, how endl and setw manipulator works. 07 OR

Q.5 (a) Write a C++ program demonstrating use of the pure virtual function with the use of base and derived classes.

07

(b) Describe briefly the features of I/O system supported by C++. 07

************

Page 4: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

2/2

જુરાતી

. 1 અ Object Oriented Programming ુ ંછે? Object Oriented Programming ના લાભ

આપો.

07

બ Reference variable ુ ંછે? ઉદાહરણ સાથે સમ વો. 07

. 2 અ Inline function ુ ંછે? Inline function નો ઉપયોગ બતાવતો ો ામ લખો. 07 બ Friend Overloading ઉદાહરણ સાથે સમ વો. 07 અથવા

બ Friend Function ઉદાહરણ સાથે સમ વો અને Friend Function ના ણુધમ ની

યાદ કરો.

07

. 3 અ Constructor ુ ં છે? Constructor નો કોઇ પણ એક કાર ઉદાહરણ સાથે

સમ વો

07

બ નીચે દશાવેલ ઉદાહરણ સાથે સમ વો.

(1) New operator (2) Destructor

07

અથવા

. 3 અ Copy Constructor ુ ંછે? ઉદાહરણ સાથે સમ વો. 07 બ Constructor ના ખાસ ણુધમ ની યાદ કરો. 07

. 4 અ C++ ની દર inheritance નો અથ ુ ંછે? Inheritance ના કયા કયા કાર છે?

Inheritance નો કોઇ પણ એક કાર ઉદાહરણ સાથે સમ વો.

07

બ યો ય ો ામ ગ ની મદદ સાથે Multiple Inheritance નો ઉપયોગ બતાવો. 07 અથવા

. 4 અ યો ય ો ામ ગ ની મદદ સાથે Multilevel Inheritance નો ઉપયોગ બતાવો. 07 બ Virtual Base Class ુ ંછે? ો ામ ગ ઉદાહરણ સાથે તે સમ વો. 07

. 5 અ Polymorphism ની યા યા આપો અને Virtual Function ઉદાહરણ સાથે

સમ વો Static Binding અને Dynamic Binding વ ચે ુ ંતફાવત છે?

07

બ ઉદાહરણ સાથે સમ વો ક કઈ ર તે endl અને setw કામ કર છે? 07 અથવા

. 5 અ Base class અને derived class નો ઉપયોગ કર ને pure virtual function નો

ઉપયોગ દશાવતો C++ નો ો ામ લખો.

07

બ C++ ારા support કરાતા I/O િસ ટમ ના લ ણો સં તમા ંસમ વો. 07

************

Page 5: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

1/4

Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY Diploma Engineering - SEMESTER–III • EXAMINATION – WINTER • 2014

Subject Code: 3330702 Date: 27-11-2014

Subject Name: Programming in C++

Time: 10:30 am - 01:00 pm Total Marks: 70 Instructions:

1. Attempt all questions.

2. Make suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.

4. English version is considered to be Authentic.

Q.1 Answer any seven out of ten. 14

1. Write a Difference between C and C++.

2. List out main feature of C++.

3. Write an Advantages of Inline Function.

4. Explain Class and Object.

5. Write the output of following.

main()

{

int i;

for(i=1;i<=5;i++);

cout<<i;

}

6. What is mean by dynamic initialization of variable?

7. Explain the call by reference and return by reference.

8. Explain Memory management operator.

9. What is Constructor? List out type of Constructor.

10. Write an application of C++.

Q.2 (a) Explain use of Scope Resolution Operator with example. 03

OR

(a) Explain Bitwise Operator in C++. 03

(b) What is reference variable? How it is difference from Pointer Variable. 03

OR

(b) What is type casting? Explain How to Convert primitive data type to User

Define Data type.

03

(c) Explain Friend function over other member function with example. 04

OR

(c) Explain Dynamic Constructor with Example. 04

(d) Write a Program which create a class name Distance and add two different

distances, input from keyboard

Data member : feet and inch

Member Function : get() , add_distance(argument)

04

OR

(d) Define a class to represent a student record which include following data

member and member function.

Data Member : (1) Enrollment No

(2) Name of Student

(3) Name of Course

(4) Marks of 3 Subject

Member Function : (1) To read a student record

(2) To find total Marks.

04

Page 6: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

2/4

(3) To display Result.

Q.3 (a) Explain the concept of Destructor with suitable Example. 03

OR

(a) Write a Program to find Minimum from Two values by passing object as

argument.Passing input from keyboard. Consider Name of Class is Temp.

Data Member : int x

Member function : Get(int n)

Max(Temp t)

03

(b) Write a Program to count the Total number of created Object. 03

OR

(b) Explain Data Abstraction and Data Encapsulation. 03

(c) What is Inheritance? Explain the different forms of Inheritance. 04

OR

(c) Explain abstract class with example. 04

(d) Explain Function Overloading with suitable Example. 04

OR

(d) Explain Constructor Overloading with example. 04

Q.4 (a) Explain this pointer with example. 03

OR

(a) Explain the Access specifier(Public , Private and Protected ). 03

(b) Explain Virtual Base Class with suitable example. 04

OR

(b) Explain Virtual Function With Example. 04

(c) Write a Program to find Maximum from Two values using following diagram.

07

Q.5 (a) Explain Polymorphism. 04

(b) Explain C++ Stream class hierarchy. 04

(c) Explain the use of following Manipulator.

(1) Setw() (2) Setfill() (3) Setprecision()

03

(d) Give the Difference between Procedure oriented Programming and Object

Oriented Programming.

03

************

A B

C

Data Member : x

Function : get_x()

Data Member : y

Function : get_y()

Function : max()

Page 7: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

3/4

ગજુરાતી પ્રશ્ન. ૧ દશમ ાંથી કોઇપણ સ તન જવ બ આપો. ૧૪

૧. C અને C++ નો તફ વત લખો.

૨. C++ ની મખુ્ય લ ક્ષણણક્ત જણ વો.

૩. Inline Function ન ફ યદ લખો.

૪. સમજાવો : Class અને Object

૫. નીચે જણ વેલ પ્રોગ્ર મ ન ુઆઉટ પટુ લખો. main()

{

int i; for(i=1;i<=5;i++);

cout<<i;

}

૬. Dynamic initialization of variable નો અથથ સમજાવો.

૭. સમજાવો : the call by reference અને return by reference.

૮. સમજવો : Memory management operator.

૯. Constructor શ ુછે? Constructor ન પ્રક ર લખો.

૧૦ C++ ની મખુ્ય application લખો.

પ્રશ્ન. ર અ Scope Resolution Operator નો ઉપયોગ ઉદ હરણ સહીત સમજાવો.. ૦૩

અથવ

અ C++ નો Bitwise Operator સમજાવો.. . ૦૩

બ reference variable શ ુછે? તે Pointer Variable થી કેવી રીતે અલગ છે તે સમજાવો.. ૦૩

અથવ

બ type casting શ ુછે? કેવવ રીતે primitive data type થી User Define Data type મ પરરવતથન કરવ ુતે સમજાવો..

૦૩

ક Friend function ઉદ હરણ સહીત સમજાવો. ૦૪

અથવ

ક Dynamic Constructor ઉદ હરણ સહીત સમજાવો. ૦૪

ડ ક્લ સ ન ુન મ Distance લઇ. બ ેજુદ જુદ અંતર નો સરવળો કરતો પ્રોગ્ર મ લખો. ઇન પટુ રક-બોડથ થી લેવ.ુ Data member : feet અને inch

Member Function : get() , add_distance(argument)

૦૪

અથવ

ડ એક ક્લ સ એવો બનવો જે સ્ટુડેંટ ને નીચે મજુબ વણવે છે.

Data Member : (1) Enrollment No

(2) Name of Student

(3) Name of Course (4) Marks of 3 Subject

Member Function : (1) To read a student record

(2) To find total Marks. (3) To display Result.

૦૪

Page 8: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

4/4

પ્રશ્ન. ૩ અ Destructor શ ુછે તે ઉદ હરણ સહીત સમજાવો. ૦૩

અથવ

અ ઓબ્જજેક્ટ ને ફાંકશન મ પ સ કરી બે મલુ્ય મ થી મહતમ શોધતો પ્રોગ્ર મ લખો. ઇન પટુ કી-બોડથ થી લેવ.ુ ક્લ શ ન ુન મ : Temp

Data Member : int x

Member function : Get(int n)

Max(Temp t)

૦૩

બ પ્રોગ મ મ ાં કેટલ ઓબ્જજેક્ટ બન્ય છે તે શોધતો પ્રોગ્ર મ લખો. ૦૩

અથવ

બ Data Abstraction અને Data Encapsulation સમજાવો. ૦૩

ક Inheritance શ ુછે? Inheritance ના પ્રકાર સમજાવો. ૦૪

અથવ

ક abstract class ઉદ હરણ સહીત સમજાવો. ૦૪

ડ Function Overloading ઉદ હરણ સહીત સમજાવો. ૦૪

અથવ

ડ Constructor Overloading ઉદ હરણ સહીત સમજાવો. ૦૪

પ્રશ્ન. ૪ અ “this pointer” ઉદ હરણ સહીત સમજાવો. ૦૩

અથવ

અ Access specifier(Public , Private and Protected ) સમજાવો ૦૩

બ Virtual Base Class ઉદ હરણ સહીત સમજાવો.. ૦૪

અથવ

બ Virtual Function ઉદ હરણ સહીત સમજાવો. ૦૪

ક નીચ ેઆપેલ આક્રુવત ની મદદ વડે બે મલુ્ય મ થી મહ્તમ શોધતો પ્રોગ્ર મ લખો.

૦૭

પ્રશ્ન. ૫ અ સમજાવો : Polymorphism. ૦૪

બ C++ Stream class hierarchy સમજાવો ૦૪

ક નીચ ેઆપેલ Manipulator સમજાવો. (1) Setw() (2) Setfill() (3) Setprecision()

૦૩

ડ Procedure oriented Programming અને Object Oriented Programming નો તફ વત લખો.

૦૩

******************

A B

C

Data Member : x

Function : get_x()

Data Member : y

Function : get_y()

Function : max()

Page 9: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

1/3

Seat No.: ________ Enrolment No.______________

GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA ENGINEERING – SEMESTER – III • EXAMINATION – WINTER- 2015

Subject Code: 3330702 Date:17-12- 2015

Subject Name: Programming in C++

Time: 10:30AM TO1:00PM Total Marks: 70 Instructions:

1. Attempt all questions.

2. Make Suitable assumptions wherever necessary.

3. Figures to the right indicate full marks.

4. Use of programmable & Communication aids are strictly prohibited.

5. Use of only simple calculator is permitted in Mathematics.

6. English version is authentic.

Q.1 Answer any seven out of ten. દશમ ાંથી કોઇપણ સ તન જવ બ આપો. 14

1. Define class with example.

૧. Class ઉદ હરણ સહ સમજાવો

2. List out main features of OOP.

૨. OOP ન features ની ય દી બન વો.

3. Write a program in C++ to calculate area of circle with default arguments.

૩. default arguments ની મદદ થી Circle ન ુકે્ષત્રફળ ગણવ નો પોગ્ર મ લખો

4. What are the different types of data types available in C++.

૪. C++ ની જુદીજુદી data types લખો

5. Write down the advantages of Object Oriented Programming.

૫. Object Oriented Programming ન ફ યદ ઓ સમજાવો.

6. Explain Private,Protected access specifier of C++.

૬. C++. ન Private,Protected એસ્સેસ સ્પેસીફ યર સમજાવો.

7. Write down the applications of object oriented programming.

૭. object oriented programming ન ઉપયોગો સમજાવો.

8. Give the importance of Static function and static data.

૮. Static function અને static data ન ુમહત્વ સમજાવો .

9. Describe the roll of destructor.

૯. destructor નો રોલ સમજાવો.

10. When constructor is called? Explain with small example.

૧૦. Constructor ક્ય રે કોલ થ ય છે? ઉદ હરણ સહ સમજાવો

Q.2 (a) Explain the difference between STRUCTURE of c and CLASS of C++. 03

પ્રશ્ન. ર (અ) Structure અને class વચ્ચે નો તફ વત આપો. ૦૩

OR

(a) Give the difference between auto and register storage class of C++. 03

(અ) C++.. મ auto and register storage class વચ્ચે નો તફ વત આપો ૦૩

(b) Write a short note on data abstraction. 03

(બ) data abstraction પર ટૂક નોધ લખો. ૦૩

Page 10: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

2/3

OR

(b) Write a short note on default arguments 03

(બ) default arguments પર ટકૂ નોધ લખો. ૦૩

(c) Explain bitwise and assignment operators in C++ with examples 04

(ક) bitwise and assignment operators ઉદ હરણ સહ સમજાવો. ૦૪

OR

(c) Explain logical and relational operators in C++ with examples 04

(ક) logical and relational operators ઉદ હરણ સહ સમજાવો. ૦૪

(d) Write a program in C++ to write function named print which will print

integer,float and character data with function overloading concept

04

(ડ) function overloading concept ની મદદ થી print ન મ ન ુfunction લખો કે જે integer,float and character data ને print કરે.

૦૪

OR

(d) Write a program in C++ to override + operator for using addition of strings. 04

(ડ) + operator ને override કરી ને બે strings નો સરવ ળો કરવ નો C++ મ ાં પ્રોગ્ર મ લખો.

૦૪

Q.3 (a) Write a program in C++ to print message “hello world” with scope resolution

operator. 03

પ્રશ્ન. 3 (અ) scope resolution operator ની મદદ થી “hello world” message print કરવ નો C++ મ ાં પ્રોગ્ર મ લખો.

૦૩

OR

(a) Write program in C++ to overload unary minus operator with the help of

operator overloading. 03

(અ) operator overloading ની મદદ થી unary minus operator ને overload કરવ નો C++ મ ાં પ્રોગ્ર મ લખો.

૦૩

(b) Write program in C++ using constructor to calculate the volume of box. 03

(બ) Constructor નો ઉપયોગ કરી ને બોક્ષ ન વોલ્યમુ ની ગણતરી કરવ નો C++ મ ાં પ્રોગ્ર મ લખો.

૦૩

OR

(b) Explain the role of virtual base class in C++. 03

(બ) C++ મ virtual base class નો રોલ સમજાવો. ૦૩

(c) Write program in C++ to demonstrate the use of parameterized constructor. 04

(ક) parameterized constructor નો ઉપયોગ સમજવ મ ટે નો C++ મ ાં પ્રોગ્ર મ લખો.

૦૪

OR

(c) Describe the characteristics of constructor. 04

(ક) Constructor ન ગણુધમો સમજાવો. ૦૪

(d) What are literals? Give one example of integer literal ,character literal ,float

literal ,Boolean literal. 04

(ડ) Literals શ ુછે? integer literal ,character literal ,float literal ,Boolean literal ન ુએક ઉદ હરણ આપો.

૦૪

OR

Page 11: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

3/3

(d) Explain the use of ‘this’ pointer with example. 04

(ડ) ‘this’ pointer ઉદ હરણ સહ સમજાવો ૦૪

Q.4 (a) Describe virtual function with example 03

પ્રશ્ન. ૪ (અ) virtual function ઉદ હરણ સહ સમજાવો ૦૩

OR

(a) Describe friend function with example 03

(અ) friend function ઉદ હરણ સહ સમજાવો ૦૩

(b) What is protected? Explain with example. 04

(બ) Protected શ ુછે? ઉદ હરણ સહ સમજાવો ૦૪

OR

(b) Explain in brief: Inline function. 04

(બ) Inline function વવષે ટૂક મ સમજાવો. ૦૪

(c) Explain different types of inheritance with example. 07

(ક) Inheritance ન જુદ જુદ પ્રક ર સમજાવો. ૦૭

Q.5 (a) Give the difference between static and dynamic polymorphism. 04

પ્રશ્ન. ૫ (અ) static અને dynamic polymorphism વચ્ચે નો તફ વત સમજાવો ૦૪

(b) Give the difference between static members and normal members

(data and functions) 04

(બ) static members અને normal members વચ્ચે નો તફ વત સમજાવો. ૦૪

(c) What is manipulator? Explain with example. 03

(ક) Manipulator શ ુછે? ઉદ હરણ સહ સમજાવો. ૦૩

(d) List out C++ steam classes 03

(ડ) C++ steam classes ની ય દી બન વો. ૦૩

************

Page 12: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

1/4

Seat No.: ________ Enrolment No.___________

GUJARAT TECHNOLOGICAL UNIVERSITY Diploma Engineering - SEMESTER–III • EXAMINATION – SUMMER • 2015

Subject Code: 3330702 Date: 02-05-2015 Subject Name: Programming in C++ Time: 02:30 pm - 05:00 pm Total Marks: 70 Instructions:

1. Attempt all questions. 2. Make Suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. 4. Use of programmable & Communication aids are strictly prohibited. 5. Use of only simple calculator is permitted in Mathematics. 6. English version is authentic.

Q.1 Answer any seven out of ten. 14

1. Define object with example 2. Write down the main features of OOP. 3. Write program in C++ to calculate simple interest with the help of default

arguments

4. What is datatypes? List the different data types of C++. 5. Describe scope resolution operator with example. 6. List access specifier used in C++. Explain any one of them. 7. Explain static data with example. 8. Explain static function with example. 9. List characteristics of constructor. 10. Explain the use of destructor. Q.2 (a) Explain user defined datatypes of C++ 03 OR (a) Explain derived datatypes of C++. 03 (b) List Arithmetic, Logical, relational operators of C++. 03 OR (b) List increment/decrement, assignment, memory management operators of C++. 03 (c) Explain inline function with example. 04 OR (c) Explain the difference between “structure” of C and “class” in C++. 04 (d) Explain type cast operator with example. 04 OR (d) Explain function prototyping with example. 04 Q.3 (a) Write program in C++ to find out sum of all the digits of given no by using call

by value. 03

OR (a) Write program in C++ to find out addition, subtraction, multiplication, division

operations with scope resolution operator of two integer numbers. 03

(b) Write program in C++ for addition operation on numbers, strings with the help of function overloading.

03

OR (b) Write program in C++ to overload unary minus operator with the help of

operator overloading. 03

(c) Explain the concept of passing object as argument. 04 OR

Page 13: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

2/4

(c) Explain the concept of reference variable with example. 04 (d) Describe friend function with example. 04 OR (d) Describe memory management operators in C++. 04 Q.4 (a) What is inheritance? List all the types of inheritance in C++. 03 OR (a) Explain multilevel inheritance with example. 03 (b) Write program in C++ to create clone of the object using copy constructor. 04 OR (b) Write program in C++ to use multiple constructor. 04 (c) Write a C++ program to use constructor in derived class. 07 Q.5 (a) What is virtual base class explain with example. 04 (b) Write a C++ program to demonstrate the use of pure virtual function with the

use of base and derived class. 04

(c) Illustrate with example working of endl, setw manipulator. 03 (d) Explain the difference between static and dynamic binding. 03

************

Page 14: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

3/4

�જુરાતી

પ�. ૧ દશમાથંી કોઇપણ સાતના જવાબ આપો. ૧૪ ૧. object ની ઉદાહરણસ�હત વ્ાા્ા આપો

૨. OOP ના �ાુ્ આઆારરથથં ��ુાદ દાો.

૩. C++ મા ંdefault arguments ની મદદ થી સાદા વ્ાજ ની ણતરર કરવાનો

પોરામ દાો.

૪. Datatypes � ુછે.? C++ ની Datatypes ની ્ાદર બનાવો.

૫. scope resolution operator ઉદાહરણસ�હત સમ�વો.

૬. C++ મા ંવપરાતા access specifier ની ્ાદર બનાવો. તેમાથી કોઈ એક

સમ�વો.

૭. static data ઉદાહરણસ�હત સમ�વો .

૮. static function ઉદાહરણસ�હત સમ�વો

૯. Constructor ના �ણુઆમ� ની ્ાદર બનાવો.

૧૦ Destructor નો ઉપ્ો સમ�વો.

પ�. ર અ C++ ની user defined datatypes સમ�વો ૦૩

અથવા

અ C++ ની derived defined datatypes સમ�વો ૦૩ બ C++ ના Arithmetic, Logical, relational operators ની ્ાદર બનાવો. ૦૩ અથવા

બ C++ ના increment/decrement, assignment, memory management operators

ની ્ાદર બનાવો.

૦૩

ક inline function ઉદાહરણસ�હત સમ�વો ૦૪ અથવા

ક “structure” of C and “class” in C++ નો તફાવત સમ�વો. ૦૪ ડ type cast operator ઉદાહરણસ�હત સમ�વો ૦૪ અથવા

ડ function prototyping ઉદાહરણસ�હત સમ�વો. ૦૪

પ�. ૩ અ C++ મા ંcall by value ની મદદ થી આપેદ નબંર ના બઆા જ આકડાદ નો

સરવાળો કરવાનો પોરામ દાો.

૦૩

અથવા

અ C++ મા ંscope resolution operator ની મદદ થી બે �ણૂાકઁ સાં્ાદ નો

સરવાળો,બાદબાકર, �ણુાકાર,થા ાકાર કરવાનો પોરામ દાો.

૦૩

બ C++ મા ંfunction overloading ની મદદ થી બે નબંર અને strings નો

સરવાળો કરવાનો પોરામ દાો..

૦૩

Page 15: GUJARAT TECHNOLOGICAL UNIVERSITY · Q.3 (a) What is friend function and write its syntax to declare . Explain & define destructor . 07 (b) Explain parameterized constructor with proper

4/4

અથવા

બ C++ મા ંunary minus operator ને operator overloading ની મદદ થી

overload કરવાનો પોરામ દાો.

૦૩

ક object ને argument તર�ક� પાસ કરવાનો �દુો સ સવો. ૦૪ અથવા

ક reference variable ઉદાહરણ સ�હત સમ�વો. ૦૪ ડ friend function ઉદાહરણ સ�હત સમ�વો.. ૦૪ અથવા

ડ C++ના memory management operators સમ�વો. ૦૪

પ�. ૪ અ Inheritance � ુછે ? C++ ના બઆાજ પકાર ના inheritance સમ�વો. ૦૩ અથવા

અ multilevel inheritance ઉદાહરણ સ�હત સમ�વો. ૦૩ બ C++ મા ંcopy constructor ની મદદથી object ની જ કોપી �વો બીજો object

બનાવવાનો પોરામ દાો.

૦૪

અથવા

બ C++ મા multiple constructor નો ઉપ્ો કરવાનો પોરામ દાો. ૦૪ ક C++ મા constructor નો ઉપ્ો derived class મા કરવાનો પોરામ દાો. . ૦૭

પ�. ૫ અ virtual base class ઉદાહરણ સ�હત સમ�વો. ૦૪ બ C++ મા base and derived class નો ઉપ્ો કરર pure virtual function નો

પોરામ દાો

૦૪

ક endl, setw manipulator ઉદાહરણ સ�હત સમ�વો. ૦૩ ડ static and dynamic binding વચ્ે નો તફાવત સમ�વો. ૦૩

************