Quiznetik

Object Oriented Programming In cpp | Set 1

1. If the class name is X, what is the type of its “this” pointer (in a nonstatic, non-const member function)?

Correct : D. x&

2. Which classes allow primitive types to be accessed as objects?

Correct : B. virtual

3. When is std::bad_alloc exception thrown?

Correct : D. object

4. Which one of the following is not a fundamental data type in C++

Correct : A. float

5. Which of the following is a valid destructor of the class name “Country”

Correct : B. void country()

6. Which of the following correctly describes C++ language?

Correct : D. type-less language

7. Which of the following keyword supports dynamic method resolution?

Correct : A. abstract

8. Which of the following is the most preferred way of throwing and handling exceptions?

Correct : B. throw by reference and catch by reference.

9. Which of the following is not true about preprocessor directives

Correct : A. they begin with a hash symbol

10. What’s wrong? while( (i < 10) && (i > 24))

Correct : D. the test condition is always true

11. A continue statement causes execution to skip to

Correct : C. the statement following the continue statement

12. What’s wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);

Correct : D. the conditional operator is only used with apstrings

13. What’s wrong? for (int k = 2, k <=12, k++)

Correct : B. the variable must always be the letter i when using a for loop

14. Which of the following is not recommended in a header file?

Correct : D. template definitions

15. Which of the STL containers store the elements contiguously (in adjacent memory locations)?

Correct : C. std::map

16. Which of the following is not a standard exception built in C++.

Correct : A. std::bad_creat

17. What does STL stand for?

Correct : B. standard template library

18. What is the difference between overloaded functions and overridden functions?

Correct : B. redefining a function in a friend class is called function overriding while redefining a function in a derived class is called an overloaded function.

19. Which one of the following is not a valid reserved keyword in C++

Correct : C. implicit

20. Each pass through a loop is called a/an

Correct : C. culmination

21. Which of the following is true about const member functions?

Correct : B. const members can be invoked only on const objects and not on nonconst objects

22. Which of the following relationship is known as inheritancerelationship?

Correct : A. ‘has-a’ relationship

23. If class A is friend of class B and if class B is friend of class C, which of the following is true?

Correct : B. class a is friend of class c

24. A direct access file is:

Correct : C. files which are stored on a direct access storage medium

25. Which of the following is not a component of file system

Correct : C. free integrity mechanism

26. Seek time is

Correct : D. none of the above

27. ‘Prime area’ in context of file system is defined as

Correct : B. it is an area into which data records are written

28. In mulit-list organization

Correct : B. records are loaded in ordered sequence defined by collating sequence by content of the key

29. Which of the following is/are advantages of cellular partitioned structure:

Correct : A. simultaneous read operations can be overlapped

30. *ptr++ is equivalenet to:

Correct : C. ++*ptr

31. The conditional compilation

Correct : D. none of above

32. Originally ‘C’ was developed as:

Correct : C. data processing language

33. An inverted file

Correct : B. a file which stores opposite records

34. Which of the following is not a file operation:

Correct : A. repositioning

35. Latency time is:

Correct : D. none of above

36. The two types of file structure existing in VSAM file are

Correct : C. entry sequence structure, exit sequenced structure

37. How many copies of a class static member are shared between objects of the class?

Correct : C. a copy of the static member is created for each instntiation of the class

38. Which looping process checks the test condition at the end of the loop?

Correct : C. do-while

39. The default access level assigned to members of a class is ___________

Correct : C. protected

40. Which of the following correctly describes the meaning of‘namespace’ feature in C++?

Correct : A. namespaces refer to the memory space allocated for names used in a program

41. Which of the following correctly describes the meaning of ‘namespace’ feature in C++?

Correct : D. namespaces provide facilities for organizing the names in a program to avoid name clashes

42. Which of the following language is not supported by C++?

Correct : D. namespaces

43. class derived: public base1, public base2 { } is an example of

Correct : B. multilevel inheritance

44. Which of the following languages is a subset of C++ language?

Correct : D. language

45. How do we declare an ‘interface’ class?

Correct : A. by making all the methods pure virtual in a class

46. How do we declare an abstract class?

Correct : A. by providing at least one pure virtual method (function signature followed by ==0;) in a class

47. Which of the following is not an advantage of secondary memory

Correct : A. it is cost-effective

48. What happens when a pointer is deleted twice?

Correct : C. it can cause an error

49. Which of the following language feature is not an access specifier in C++?

Correct : D. internal

50. Expression C=i++ causes

Correct : D. i to be incremented by 1

51. The statement i++; is equivalent to

Correct : A. i = i + i;

52. In C language, a hexadecimal number is represented by writing

Correct : B. xo

53. Which of the following library function below by default aborts the program?

Correct : C. abort()

54. If a member needs to have unique value for all the objects of that same class, declare the member as

Correct : A. global variable outside class

55. Value of ix+j, if i,j are integer type and ix long type would be

Correct : B. float

56. Which of the following below can perform conversions between pointers to related classes?

Correct : C. static_cast

57. How do we define a constructor?

Correct : C. x() ~{}

58. Vtables

Correct : D. creates a dynamic table per object

59. When class B is inherited from class A, what is the order in which the constructers of those classes are called

Correct : A. class a first class b next

60. Which of the following is the most general exception handler that catches exception of any type?

Correct : A. catch(std::exception)

61. Which of the following is the most general exception handler that catches exception of ‘any type’?

Correct : C. catch(…)

62. In a group of nested loops, which loop is executed the most number of times?

Correct : C. all loops are executed the same number of times

63. What is the Difference between struct and class in terms of Access Modifier?

Correct : B. by default all the struct members are protected while by default class members are private.

64. Inline functions are invoked at the time of

Correct : C. depends on how it is invoked

65. What is shallow copy?

Correct : B. a shallow copy just copies the values of the data as they are.

66. What is deep copy?

Correct : B. a deep copy just copies the values of the data as they are.

67. Which of the following below is /are a valid iterator type?

Correct : A. input iterator

68. What defines a general set of operations that will be applied to various types of data?

Correct : D. both a and c above

69. Under which of the following circumstances, synchronization takes place?

Correct : B. when the buffer is empty

70. Which of the following functions below can be used Allocate space for array in memory?

Correct : D. both a and b

71. Statement scanf(“%d”,80);

Correct : A. assign an integer to variable i

72. STL is based on which of the following programming paradigms?

Correct : A. structured programming

73. Which of the following is not a component of file system

Correct : C. free integrity mechanism

74. If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?

Correct : B. braces { }

75. Which of the following members do get inherited but become private members in child class

Correct : B. private

76. Which looping process is best used when the number of iterations is known?

Correct : C. do-while

77. In a C language ‘3’ represents

Correct : A. a digit

78. Which of the following is the most common way of implementing C++?

Correct : C. c++ programs are interpreted by an interpreter

79. Which of the following operators can be implemented as a nonmember operator?

Correct : C. [. (array access operator)

80. What is the implicit pointer that is passed as the first argument for nonstatic member functions?

Correct : D. ‘this’ pointer

81. Which of the following operators can be overloaded?

Correct : D. ?: (conditional operator)

82. Which of the following operators below allow to define the member functions of a class outside the class?

Correct : D. %

83. Which of the following is not a valid conditional inclusions in preprocessor directives

Correct : A. #ifdef

84. Value of a in a = (b = 5, b + 5); is

Correct : B. syntax error

85. Minimum number of temporary variable needed to swap the contents of 2 variables is:

Correct : D. 0

86. How to declare operator function?

Correct : A. operator operator sign

87. xample obj = new Example (1,2,3);

Correct : B. constructor 4