MCQ Bank
Programmer should be very careful about the memory management because it can _____________.
- A) return void pointers
- B) affect the logic of the program
- C) cause problems of memory leakage and dangling pointers
- D) create problems of NULL pointers
Public member functions of the class ______________main program.
- A) are defined within the
- B) are accessible in
- C) are private to
- D) are not accessible in
What allows an object to interact with private data members of a class?
- A) Public member functions
- B) Inheritance
- C) Global variables
- D) Pointers
We use dot operator to access the data members of both ___________ and ____________.
- A) unions, arrays
- B) arrays, structures
- C) none of them
- D) unions, structures
The data members of the class are initialized ______________.
- A) at compile time
- B) outside the function
- C) at runtime
- D) within main program
Default constructor generated by ______________does ______________for us.
- A) compiler , initialization
- B) compiler, no initialization
- C) classes , initialization
- D) main program, memory management
Which of the following is NOT a valid preprocessor directive?
- A) #define
- B) #function
- C) #ifdef
- D) #pragma
A class is _____________.
- A) a member function
- B) an array
- C) a built in function
- D) a user defined data type
The exclusive OR operator returns 1 if ______________.
- A) None of the given
- B) Both inputs are 1
- C) Both inputs are 0
- D) One input is 1 and other is zero
The memory allocation functions return a chunk of memory with a pointer of type_______________.
- A) void
- B) ptr
- C) integer
- D) float
Array indexes start from __________.
- A) 0
- B) 3
- C) 1
- D) 2
These functions seekg() and seekp() requires an argument of type ____________to determine that how many bytes to be move forward or backward.
- A) long
- B) double
- C) int
- D) short
_______________function gives the position of the next character to be read from that file.
- A) seekg()
- B) tellp()
- C) seekp()
- D) tellg()
student s[100]; means that ‘s’ is an array of hundred students of type ‘student’ structure. What will be the correct statement to access the ‘name’ data element of the fifty sixth student from the array?
- A) s.name[55];
- B) s[55].name;
- C) s.name[56];
- D) s[56].name;
a = a & b; can be written as_____________.
- A) a = b;
- B) a =& b;
- C) a=a & b;
- D) a &= b;
Destructor _______________________.
- A) cannot be overloaded and have no return type
- B) takes no arguments and can be overloaded
- C) cannot be overloaded and have return type
- D) can be overloaded and have return type
The original value remains unchanged in _________.
- A) Call by reference
- B) Dynamic Variables
- C) Call by value
- D) Pointers
malloc function returns ___________to the __________________ from the available memory.
- A) integer pointer, middle of the chunk of memory allocated from the heap
- B) NULL pointer, end of the chunk of memory allocated from the stack
- C) void pointer , starting of the chunk of memory allocated from the heap
- D) void pointer, starting of the chunk of memory allocated from the array
_______ is the pointer which determines the position in a file from where the next read operation occurs.
- A) Get
- B) Set
- C) Put
- D) Tell
The function overloading requires__________________.
- A) the argument list to be different.
- B) the arguments of integer type only
- C) no arguments
- D) the argument list to be the same