MCQ Bank
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
By writing aFile.seekg(15L, ios::cur) we are moving ______________.
- A) 15 bits in the backward direction starting from the previous position
- B) 15 bytes in the backward direction starting from the current position
- C) 15 bits in the backward direction starting from the current position
- D) 15 bytes in the forward direction starting from the current position
Structures are syntactically defined with the word_____________.
- A) struc
- B) struct
- C) structure
- D) None of the given
When is a destructor automatically called?
- A) When an object goes out of scope or is deleted
- B) When an object is created
- C) When a program starts
- D) Only when explicitly called
How is a destructor named in C++?
- A) _ClassName()
- B) ~ClassName()
- C) destroyClassName()
- D) ClassName~()
Shifting the binary numbers is similar to shifting the _____ numbers.
- A) Decimal
- B) Hexadecimal
- C) Base 7
- D) Octal
What is the main advantage of using macros instead of functions for simple tasks?
- A) Macros reduce memory usage
- B) Macros compile faster
- C) Macros avoid function call overhead
- D) Macros are more secure
To access the data members of structure, _______ is used.
- A) Dereference operator
- B) Logical operator
- C) Dot operator
- D) Address operator
The malloc function takes ___________ argument(s).
- A) three
- B) four
- C) two
- D) one
The members of a class declared with the keyword struct are _____________by default.
- A) static
- B) public
- C) protected
- D) private