July 16, 2021 in C and CPP
Write short notes on any three of the followings
9. Write short notes on any three of the followings
i) Operator Overloading
ii) Inheritance
iii) Friend function and friend class
iv) Class template
July 16, 2021 in C and CPP
9. Write short notes on any three of the followings
i) Operator Overloading
ii) Inheritance
iii) Friend function and friend class
iv) Class template
July 16, 2021 in C and CPP
c) Can we place two or more catch blocks together to catch and handle multiple types of
exceptions thrown by a try block? If your answer is yes, please write the syntax.
July 16, 2021 in C and CPP
b) Design a single manipulator format to provide the following output specifications for
printing float values:
i) 10 columns width
ii) Right-justified
iii) Two digits precision
iv) Filling of unused places with *
v) Trailing zeroes shown
July 16, 2021 in C and CPP
a) What are manipulators? Write the general form of the user defined manipulators.
July 16, 2021 in C and CPP
7. Write a C++ program (cp.cpp) to copy any kind of file (.txt or .exe) which accepts the
source and destination file name from the command line. Finally the program should
work for copying the file. e.g.
cp source.exe dest.exe
or
cp source.txt dest.txt
(
July 16, 2021 in C and CPP
6. Design classes such that they support the following statements:
Dollar d1, d2;
Rupee r1, r2;
Write a complete program which does such conversions according to the world market
value. Take $ 1 = Rupee 45 as a conversion factor.
July 16, 2021 in C and CPP
b) Write the above overloaded functions swap as a generic function.
July 9, 2021 in C and CPP
a) Write overloaded functions swap for swapping data of different types, i.e. the two
parameters of reference type character, integer and float. In main program read two
values each of character type, integer type and float type. Display the original values of
these different types and make a call to swap function and display their final values after
making a call to swap.
July 9, 2021 in C and CPP
A. run-time B. namespace name C. constructor
D. istream& E. Standard Template
Library
F. private
G. ostream& H. local I. output
J. free store K. global L. Open
M compile-time N flush O public
4.1 Classes can be defined and used inside a function or a block. Such classes are called
________ classes.
4.2 The new and delete are known as ________ operators.
4.3 The typeid operator is used to find the type at ________ of unknown objects.
4.4 The collection of generic classes and functions is called ________.
4.5 Same variable declared and assigned with different values in various nested blocks can
be accessed by using ________.
4.6 A file can be opened in two ways by using ________ function of the class, and the other
using the member function ________ of the class.
4.7 The class cannot have virtual ________, but can contain virtual destructor.
4.8 To get benefits of virtual functions supporting runtime polymorphism, they should be
declared in the ________ section of a class.
4.9 The overloading of extraction operator for user defined types should have a return type
of ________.
4.10 The flag ios::stdio is used to ________ stdout and stderr after insertion.
July 9, 2021 in C and CPP
Each statement below is either TRUE or FALSE. Choose the most appropriate one
and ENTER in the “tear-off” sheet attached to the question paper, following
instructions therein.
2.1 The ios::app mode allows us to write data anywhere in the file.
2.2 It is legal to have an object of one class as a member of another class.
2.3 Function templates requires more memory space than normal function.
2.4 Templates are processed by the compiler.
2.5 Overloaded operator functions can be function templates.
2.6 There are only two visibility mode i.e. public and private.
2.7 When a derived class is instantiated only the derived class constructors are invoked.
2.8 Destructors are invoked in the reverse order of constructors.
2.9 The parameter type to overloaded subscript [ ] operator can be of any data type.
2.10 A constructor can be used to convert user-defined data types only.