Friday, October 27, 2017

C++ One Mark Question and Answer for BCA & B.Sc(IT) Students


--------------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah - HOD(IT)
Mobile No : 7600044051
E-Mail : rupareleducation@gmail.com

Object Oriented Programming Using C++


1.       To perform the write operator on output device, c++ uses.
Ans : bit wise left-shift operator

2.       Which keyword is used to perform the write operation in c++.       
Ans : cout  

3.       ________ is derived data type.
          Ans : Array

4.       Symbol of scope resolution operator is.
          Ans :   ::

 5.      inline function we can use loop and nesting of if, statement is.
          Ans : False

6.       Function with constant argument, argument is declared as constant with _____keyword.
Ans : Const

7.       Which of the member can be access outside the body of the class.
          Ans : public

8.       object of the same class can be passed to the member function of the class by.
          Ans : Reference

9.       ____ is the member function which will be executed last, when the object is created.
Ans : Destructor

10.     Constructor must be explicitly invoked - the statement is.
Ans : False

11.     A unary operator member function takes ____ parameters.
          Ans : zero  



12.     Which of the following operator can not be overloaded?
          Ans : sizeof() , ternary           

13.     When a class is derived from another derived class  then it is called ______.     
Ans : Single Inheritance

14.     Which of the following is true in inheritance, when the object of the derived class is created.                
Ans : First the derived class is instantiated

15.     A virtual function with null body is called____.                                                 
Ans : Purer Virtual Function

16.     If instance of a class can be created then such class is called.                             
          Ans : Class or Simple Class

17.     ___ ios flag is used to print the decimal point and tralling zero.                                  
Ans : showbase

18.     getline()  is the function defined in ____ class.    
Ans : istream

19.     ____ mode is used to over write the file.                      
          Ans : app  (Append)

20.     In function template the function will be created at the time of.                
          Ans : some time at compile time and some time at execution time

21.     Which mechanism associates the code and data into a single unit and keeps them safe from external interference and misuse.
          Ans : Encapsulation

22.     in C ++ Main Function always return.      
          Ans : integer

23.     ____operator is used to release memory dynamically.
          Ans : Delete

24.     break statement will terminate the.
Ans : loop

25.     main() function consist ____ number of arguments.
Ans : Two   

26.     inline function is used when function having large body. Statement is.
Ans : False
           
27.     A function which can access the private member function outside the body of the class with the class with the help of object is called.
Ans : Friend Function   

28.    ___is the first member function which will be executed first, when the object is created.
          Ans : Constructor

29.     Which of the following is true for destructor.
          Ans : It may be declared under public section
           
30.     A binary operator member function takes___ parameters.
          Ans : one   

31.     Overload operator member function can never have default arguments? the statement is.
          Ans : True
           
32.     During dynamic memory allocation in CPP, new operator returns _________ value if memory allocation is unsuccessful.   
Ans : NULL

33.     A class become the base class for more then two derived class then it is called___.            
         Ans : Hierarchical inheritance  

 34.    Which symbol is used to declare a pointer variable.                                           
 Ans :  *               

 35.    General syntax of this pointer is.                                  
          Ans : extern classname *this 

36.     ___ios flag is used to print base of the numeric data.                                
          Ans : Showbase
         
37.     ___manipulator is put the \0 at the end of output stream.     
          Ans : ends 

38.     seekg (-n, ios::cur) moves the cursor.                  
          Ans : nth byte backward from the current position

39.     Which of the following is invalid in template.       
a) test <double, 6>5>;   b) test<double,(6>5); 
c) a & b both are valid   d) None of these

40.     Full form of AOP.
Ans : Aspect Oriented Programming      

41.     Creator of c++.    
          Ans : Bjarne Stroustrup       

42.     c++ identifier is also known as.
          Ans : keywords   and variable

43.     pick out non parameterized manipulator.
          Ans : setw  

44.     Function prototype is only declared for    
          Ans : compiler              

45.     main() function consist _____ number of arguments.
          Ans : int argc      

46.     Member function define out side the body of the class is by default becomes.
          a) inline                          b) outline                       c) friend      d) None

47.     A Pointer, which can point to any member of the class can created, the statement is.
          Ans : true
48.     A constructor without any parameter is called.
          Ans : Default constructor        

49.     The operator which operates on three operand is called ____.
Ans : Ternary Operator



50.     Which of the following operator can not be overloaded with friend function.
           Ans :  =  Assignment  , ()  Function call    , []  Subscript

51.     Which of the following is not the visibility mode.
          Ans : virtual       

52.     Derived class also referred as.
           Ans :  child class  and  sub class                       

53.     ____ pointer will be create when the member functions is invoked through the object.          
           Ans :  This            

54.     If instance of a class can not be created then such class is called.                                     Ans : Abstract Class

55.     To flushes all the stream ____ ios flag isused.                                          
Ans :  stdio          

56.     _____ ios flag is used  to print the sign before the fill character.                                  
          Ans : left   

57.     tellg() is the member function of _____ class.     
          Ans : ifstream     

58.     pick out non parameterized manipulator.
          Ans : setw           

59.     Function prototype is only declared for    
Ans : compiler              

60.     main() function consist _____ number of arguments.
Ans : char ** envp      

61.     Member function define out side the body of the class is by default becomes.
Ans : Outline       

62.     Can constructors be overloaded?
Ans : Yes

63.    When overloading unary operators using Friend function,it requires_____ argument/s.
Ans : One 

64.    In CPP program, Can we declare and define a user defined function inside a struct as we do in a class ?
Ans : Yes

65.     Runtime polymorphism is achieved only when a virtual function is accessed through a pointer to the base class.
Ans : True

66.     Assigning one or more function body to the same name is called ____________ .
          Ans : Function Overloading

67.    Function overloading can also be achieved if two or more functions differ only in their return types.
          Ans : False

68.    A function can be declared as friend maximum only in two classes.
          Ans : False

69.    When a child class inherits traits from more than one parent class, this type of inheritance is called _______________ inheritance.
          Ans : Multiple.

70.     __________________ is the OOP feature and mechanism that binds together code and the data it manipulates, and keep both safe from outside world.
          Ans : Data Encapsulation

71.    We can create objects of the abstract class.
          Ans : False

72.    Which of the followings are true about Virtual functions?
          They must be non-static member function of the class
Ans : They cannot be friends
         Constructor Functions cannot be virtual

73.    If a class contains static variable, then every object of the class has its copy of static variable.
          Ans : False
74.    In Multipath inheritance, in order to remove duplicate set of records in child class, we ___________ .
          Ans : Make base class as virtual base class

75.     If base class has constructor with arguments, then it is ________________ for the derived class to have constructor and pass the arguments to base class constructor.
          Ans : Mandatory

76.    An operator function is created using _____________ keyword.
          Ans : Operator

77.    Classes in CPP are________ .
          Ans : User defined data types

78.    Can we define our exceptions in CPP?
          Ans : Yes

79.    The code of statements which may cause abnormal termination of the program should be written under_________ block.
          Ans : Try

80.    When a virtual function is redefined by the derived class, it is called___________.
          Ans : Overriding

81.    In any ways, Non-member function cannot have access to the private data of the class.
          Ans : False

82.    In CPP, dynamic memory allocation is done using ______________ operator.
          Ans : New

83.    Can we allocate memory for the objects dynamically in CPP?
          Ans : Yes

84.    If the derived class is struct, then default visibility mode is _______ .
          Ans : Public

85.     ___________ header file is used for manipulators.
          Ans : iomanip.h
86.    const member function does not allow to modify/alter value of any data member of the class.
          Ans : True

87.    Can struct be used as Base class for inheritance ?
          Ans : Yes

88.    Is it possible to define a constructor with default arguments?
          Ans : Yes

89.    The purpose of explicit keyword is to tell the compiler that a certain constructor may not be used to implicitly cast an expression to its class type.
          Ans : True

90.     Scope resolution operator is used______ .
          Ans :  to resolve scope of global variables as well as functions of the classes

91.    A try block can be nested under another try block.
          Ans : True

92.    We can prevent a function from throwing any exceptions.
          Ans : True

93.    Functions called from within a try block may also throw exception.
          Ans : True

94.    The explicit keyword is an optional decoration for the constructors that takes exactly_____argument.
          Ans : One

95.    A class can contain objects of other classes and this phenomenon is called_________ .
          Ans : Containership

96.    Can we alter/modify the values of data members of a class inside const member function?
          Ans : Yes

97.    If a class contains pure virtual function, then it is termed as____________________ .
          Ans : Abstract Class

98.     If inner catch handler is not able to handle the exception then__________ .
          Ans : Compiler will check for appropriate catch handler of outer try block

99.    In CPP program, Can we declare and define a user defined function inside a struct as we do in a class ?
          Ans : Yes

100.   ____________ refers to the act of representing only essential features without including the background details.
          Ans : Data Abstraction


101.    Generic pointers can be declared with__________ .
          Ans : Void

102.   A Constructor that does not have any parameters is called____________ Constructor.
          Ans : Default

103.    _______________ is a member function that is declared within a base class and redefined by derived class.
          Ans : Virtual Function

104.   Syntax for Pure Virtual Function is ______________ .
          Ans :  virtual void show()=0

105.     Logical expressions produce ____________ type results.
          Ans : Bool

106.      A friend function does not have 'this' pointer associated with it.
          Ans : True

107.   In CPP, it is mandatory and must to initialize const variables.
          Ans : True

108.     A virtual function that has no definition within the base class is called____________.
          Ans : Pure virtual function

109.     Constant variables can be created in CPP by using ________ .
            Ans : Enum , Const , #define

110.   In CPP, cin and cout are the predefined stream __________ .
          Ans : Objects

111.     _________________are used for generic programming.
          Ans :  Templates


Best Of Luck

Please give your comment and share it...