0% found this document useful (0 votes)
3 views

cse_ass2024

The document contains a series of programming questions and tasks related to C++, covering topics such as class definitions, operator overloading, inheritance, and various programming concepts. It includes specific coding assignments, theoretical questions, and explanations of C++ features like encapsulation, polymorphism, and data types. Additionally, it emphasizes the importance of understanding functions, arrays, and operator overloading in C++.

Uploaded by

rudrasomani2612
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

cse_ass2024

The document contains a series of programming questions and tasks related to C++, covering topics such as class definitions, operator overloading, inheritance, and various programming concepts. It includes specific coding assignments, theoretical questions, and explanations of C++ features like encapsulation, polymorphism, and data types. Additionally, it emphasizes the importance of understanding functions, arrays, and operator overloading in C++.

Uploaded by

rudrasomani2612
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Prepare following questions

Q.2 Write a C++ program that prints (6) ***


a. 1.0000e+00 1.000
b. 5.0000e-01 1.500
c. 3.3333e-01 1.833
Q.12 In the following output, the following flag constants are used with the stream
member function setf. What effect does each have *** (6)
1. ios::fixed
2. ios::scientific
3. ios::showpoint
4. ios::showpos
5. ios::right
6. ios::left
Q.13 Define a class Distance with feet and inch and with a print function to print the
distance. Write a non-member function max which returns the larger of two distance
objects, which are arguments. Write a main program that accepts two distance objects from
the user, compare them and display the larger. ***

Q.18 Answer briefly: * (2x6=12)


(i) What happens in a while loop if the control condition is false initially?
(ii) What is wrong with the following loop
i. while (n <= 100)
ii. Sum += n * n;
(iii) What is wrong with the following program

int main( ) {
const double PI;
int n;
PI = 3.14159265358979;
n = 22;
}

(iv) When a multidimensional array is passed to a function, why does C++ require all
but the first dimension to be specified in parameter list?
(v) Why can’t ** be overloaded as an exponentiation operator?
(vi) How many constructors can a class have, and how should they be distinguished.
Q.26 Identify and remove error from the following, if any :*
array_ptr = new int [10] [10] [10];
array_ptr = new int [20] [ ] [ ]; (2)
Q.27 What is the task of the following code:* (2)
cout << setw (4) << XYZ << endl
Q.33 What is multiple inheritance? Discuss the syntax and rules of multiple inheritance
in C++. How can you pass parameters to the constructors of base classes in
multiple inheritances? Explain with suitable example. * (6)
Q.35 What do you mean by static class members? Explain the characteristics of static
class members with suitable examples. *** (6)
Q.43 Explain the difference between macro & function.*** (6)
Q.44 Write a C++ program to find the sum of digits of a number reducing it to one digit.***
(6)
Q.45 Explain the use of break and continue statements in switch case statements.***
(6)
Q.46 What is Object Oriented Programming (OOP)? What are the advantages of
Object Oriented Programming?* (3)
Q.47 Differentiate between recursion and iteration.** (6)
Q.48 What are the different storage classes in C++.** (6)
Q.49 Write a program to overload the unary minus operator using friend function.* (6)
Q.50 Write a program in which a class has three data members: name, roll no, marks of 5
subjects and a member function Assign() to assign the streams on the basis of table
given below:* (6)

Q.54 Write a C++ program to prepare the mark sheet of a university examination with
the following items from the keyboard:* (6)
Name of the student
Roll no.
Subject name
Subject code
Internal marks
External marks
Design a base class consisting of data members Name of the student and Roll no.
The derived class consists of the data members Subject name, Subject code,
Internal marks and External marks.

Q.55 Explain the following:*


a) Non public constructors
b) Inline function
c) Virtual functions
d) Types of Inheritance. (4x3=12)
Q.58 What are the basic differences between manipulators and ios member functions in
implementation? Give examples. *** (6)
Q.62 How can a common friend function to two different classes be declared?* (3)
Q.64 Explain any three drawbacks of procedure oriented languages. Give an example
each in C language to highlight the drawback. *** (3)

Q.68 Why is destructor function required in class? What are the special characteristics
of destructors? Can a destructor accept arguments? *** (3)

Q.70 Differentiate and give examples to bring out the difference between following ***
1. private and public inheritance.
2. instantiation and specialization of a template class.(leave it)
3. static and dynamic binding.
4. a class and a struct (4x 3)

Q.71 Explain the order in which constructors are invoked when there is multiple
inheritance.* (4)

Q88 What is encapsulation? What are its advantages? How can encapsulation be
enforced in C++? *** (6)
Q.92 Differentiate and give examples to bring out the difference between *
1. function overloading and function overriding
2. function template and inline functions (Leave it)
3. default constructor and copy constructor
4. public and private access specifiers (4 x3 =12)

Q.93 The keyword ‘virtual’ can be used for functions as well as classes in C++. Explain
the two different uses. Give an example each.*** (6)

Q.109 Write short notes on * (4x3 )


1. Constructor
2. Stream
3. Access control.
4. Friend.

Q.110 What is the difference between passing a parameter by reference and constant
reference? * (3)

Q.111 Define the following terms and give an example to show its realization in C++ *
(i) Encapsulation (ii) Class variables and class functions (iii) Repeated inheritance
(iv) Overloading (3 x 4)

Q.124 Differentiate between * (8x2=16)


a. int* q = p; and n = *p;
b. Constructor and destructor
c. Interface and implementation of a class
d. public and private member of a class
e. Overloaded pre-increment operator and overloaded post increment operator
f. Abstract and concrete class
g. get ( ) and getline ( ) function
h. Composition and inheritance

Q.129 Discuss the role of inheritance in object-oriented programming. What is public,


private and protected derivation?* (3)

Q.130 Explain the meaning of polymorphism. Describe how polymorphism is


accomplished in C++ taking a suitable example?** (6)

Q.134 Describe the basic characteristics object-oriented programming.** (3)

Q.143 Write short notes on the following: *** (3*3=12)


1. Nested class.
2. Scope resolution operator.
3. this pointer.
Q.144 Define the following terms related to Object Oriented Paradigm: ***
Encapsulation, Inheritance, Polymorphism, Data Abstraction (6)

Q.149 Discuss the various situations when a copy constructor is automatically


invoked.*** (6)
Q.148 Explain a pure virtual function with an example.*** (6)
Q.150 What are the advantages and disadvantages of inline functions? *** (3)
Q.151 Define Rules for operator overloading. Write a program to overload the subscript
operator ‘[ ]’. *** (6)
Q.153 How does visibility mode control the access of members in the derived class?
Explain with an example.*** (6)
Q.156 Write a program having a base class Student with data member rollno and
member functions getnum() to input rollno and putnum() to display rollno.
A class Test is derived from class Student with data member marks and member
functions getmarks() to input marks and putmarks() to display marks. Class
Sports is also derived from class Student with data member score and member
functions getscore() to input score and putscore() to display score. The class
Result is inherited from two base classes, class test and sport
Test and class Sports with data member total and a member function display()
to display rollno, marks, score and the total(marks + score). (6)
Q.161 What are the benefits of object oriented programming? Explain.** (3)
Q.162 Explain Inline functions and the situations where inline expansion may not work and
why?*** (3)

Followings must be prepared to cover

Explain Primitive data types. Give examples.


What is Structure?, Explain variation in deceleration, initialization and accessing
internal data. Give example also. (refer. Structures IET.pdf)
Explain Assignment Operators, Bitwise Operators, Conditional Operators, Comma
Operators, The sizeof Operator, pointer operator (Refer. Operators in C++ | Types &
Precedence (Examples).pdf )
What is a unary and binary operator in C++?
What is operator overloading in C++?
Explain String Function & Purpose. Give Example also(Refer. C++ Strings.pdf)
C++ program to Create your own strlen function and create your own strcpy function.(
C++ Strings.pdf, P11)
Read completely iet-Old Assignment Answers.pdf also. There are some important
Questions.
Functions(Different types of function and parameter passing is important) and
Array(Declaration 1d,2d, capacity precautions, accessing elements are important) is
also important, Go thru notes

Read All Pdf of Notes Directory All Lab Journal


Programmes are important

You might also like