C++  | OOPS | Online Test | C 

 

C++ FAQ      4futureengineers.com


1. The relational operator in C++ "!=" means
Ans: not equal to

2. A feature that allows one interface to be used for a general class of actions, is called

Ans : Polymorphism

3. The process by which one object can acquires the properties of another objects, is called

Ans : Inheritance


4. The mechanism that binds together code & data it manipulates, keeps both safe from outside interference & misuse, is called
Ans : Encapsulation

5. How many parameters can be passed to a function
Ans : as many parameters as are defined in the function definition

6. The statements that provide a means of immediately terminating the execution of the loop, is
Ans : break

7. What is the minimum number of times the body of for loop is executed
Ans : zero

8. The symbol "+=" is used to denote
Ans : addition assignment

9. The operator which returns the remainder of the division operation, is that
Ans : %

10. The variables or methods that can be accessed only by subclasses and not by any other class,are called
Ans : protected

11. The two operations x+=1 & y=x can be simultaneously written as
Ans. y=++x

12. In the above question the operation is called
Ans : prefix

13. "?" operator is called
Ans : ternary

14. If the body of the while loop is empty, then the statement is called
Ans : null statement

15. The statement that causes program control to transfer back to the caller of the method,can be said as
Ans : return

16. A class is a ______ for an object
Ans : template

17. To dynamically allocate memory we use
Ans : new

18. To refer to the current object, we use the keyword
Ans : this

19. For overloaded function, the compiler chooses the right specific version on the basis of the parameter,is
Ans : type,order or number

20. A member that can be accessed before any objects of its class created is called
Ans : static member

21. A function that has access to all private and protected members of the class for which it is a friend, is called
Ans : friend function

22. The restrictions that are applied to friend function are
Ans : (i)A derived class does not inherit friend function
(ii)friend functions may not have a storage-class specifiers


23. In C++,you can create short functions that are not actually called;rather their code is expanded in line at the point of each invocation, are called
Ans : inline function

24. To initialize an object, we use
Ans : ob(i) ob=i   . OB=Object i=value.

25. To access member of a class given a pointer to an object, we use
Ans : ->

26. A base pointer can be used to point
Ans : a derived object or a base class object

27. To allocate memory dynamically
Ans : new

28. The prototype for the function that overload new operator is like that
Ans : void *operator new (size_t size)

29. The sceleton for a function that overload delete operators is like that
Ans : void operator delete(void *p)

30. The default base-class access specifiers is
Ans : private

31. A member function that is declared within a base class & redefined by a derived class is called
Ans : virtual function

32. C++ determines which version of virtual function to call based upon the type of object pointed to by the pointer
Ans : at run time

33. The redefinition of a virtual function by a derived class is called
Ans : overriding

34. A virtual function that has no definition within a base class is called
Ans: a pure virtual function

35. A class that contains at least one pure virtual function, is said to be
Ans : abstract

36. Events that occur at compile time is called
Ans : Early binding/static binding

37. Function calls that are not resolved until runtime, is called
Ans : late binding/Dynamic binding

38. A generic function that defines a general set of operations that will be applied to various types of data, is created using the keyword
Ans : template

39. Code that you want to monitor for exceptions must have been executed from within a
Ans : try block

40. The exception is caught & processed using
Ans : catch

41. Throwing an unhandled exception causes the standard library _________ to be invoked
Ans : terminate()

42. Attempting to throw an exception that is not supported by a function will cause standard library function _______ to be called
Ans : unexpected

43. When you rethrow an exception, it will be recaught by the
Ans : next catch statement

44. A class that contains many member function and variables that control or monitor the functional operation of a stream, is
Ans : ios

45. To directly set the various format flags related to a stream, we use the manipulator
Ans : setiosflags

46. To insert characters into a stream, we use the output operator
Ans : <<

47. To read & discard characters from the input stream, we use the member function
Ans : ignore()

48. In RTTI, to obtain an object's type, we use
Ans : typeid

49. The function that can not modify the object that invokes it, is said to be
Ans : const member function

50. To access the dynamically allocated array, you must use a second function, called str(),which has the prototype:
Ans : char *str();