July 8, 2021 in C and CPP
What is object oriented programming?
a) What is object oriented programming? How is it different from procedure-oriented
programming?
July 8, 2021 in C and CPP
a) What is object oriented programming? How is it different from procedure-oriented
programming?
July 8, 2021 in C and CPP
A. encapsulation B. ios C. one value
D. class E. break F. class library
G. delete H. multiple inheritance I. two values
J. Scope-resolution operator K. data hiding L. virtual functions
4.1 If we do not write the ________ statement, even if a condition matches, switch continues execution.
4.2 A function is allowed to return ________.
4.3 The ________ usually resolves ambiguities.
4.4 A template argument is preceded by the keyword ________.
4.5 A group of related classes, supplied as a separate product, is often called a(n) ________.
4.6 The ________ operator is used to release memory allocated dynamically.
4.7 ________ allows a derived class to have more than one base class.
4.8 C++ achieves polymorphism through ________.
4.9 The base class for most stream classes is the ________ class.
4.10 The wrapping up of data and functions into a single unit is called ________.
July 8, 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 In general, switch is faster than if-else.
2.2 By default the members of a class are private.
2.3 The length of a string object s1 can be obtained using the expression s1.length.
2.4 All functions in an abstract base class must be declared pure virtual.
2.5 Throwing an exception always causes program termination.
2.6 The expression for (;;) is the same as a while loop with a test expression of true.
2.7 We cannot use the % operator to compute the remainder of an array index.
2.8 There is no direct mechanism to locate a sub-string in a string.
2.9 Static member functions are independent of objects.
2.10 If no overloaded operators are provided, C++ automatically provides them.
July 8, 2021 in C and CPP
1.10 If we generalize functions, we get a
A) model
B) template
C) structure
D) class
July 8, 2021 in C and CPP
1.9 If a subclass contains a method with the same name and arguments as in the base class,
it is
A) overloading
B) overriding
C) polymorphism
D) error
July 8, 2021 in C and CPP
1.8 What is the error in the following code?
class Test
{
virtual void draw( ) ;
};
A) No error
B) Function draw( ) should be declared as static.
C) Function draw( ) should be defined.
D) Test class should contain data members.
July 8, 2021 in C and CPP
1.7 Consider the following class definition
class Person
{}
;
class Student: protected Person
{}
;W
hat happens when we try to compile this class?
A) Will not compile because class body of Person is not defined.
B) Will not compile because class body of Student is not defined.
C) Will not compile because class of Person is not public inherited.
D) Will compile successfully.
July 8, 2021 in C and CPP
1.6 Which of the following is good reason to use an object-oriented language?
A) It's easier to conceptualize an object-oriented program.
B) program statements are simpler than in procedural languages.
C) An object-oriented program can be taught to correct its own error.
D) None of these
July 8, 2021 in C and CPP
1.5 If p is a pointer, then p++ means
A) Increment the value of p
B) Increment the pointer p
C) Increment the address of the variable to which p is pointing
D) Increment the value of the variable to which p is pointing
July 8, 2021 in C and CPP
1.4 The library function exit() causes an exit from
A) the loop in which it occurs.
B) the block in which it occurs.
C) the function in which it occurs.
D) the program in which it occurs.