MCQ Bank
The bit manipulation operator ______________ is used to check whether a specific bit is set or not.
- A) |
- B) &
- C) ^
- D) *
In C++, default visibility of structure is ______.
- A) Pass
- B) Public
- C) Protected
- D) Private
In C++, which operator is used while accessing through the pointer to structure?
- A) ->
- B) =
- C) _
- D) &
Functions seekg () and seekp () require an argument of type ____ to let them know how many bytes to move forward or backward.
- A) int
- B) long
- C) float
- D) double
In C++, __________ function is used to write a character into a file while _______ is used to get a character from a file.
- A) getc(), putc()
- B) putc(), getc()
- C) tellg(), seekg()
- D) seekg(), tellg()
In bit manipulation of binary systems, if we shift a bit towards right then it means we are ______________ that binary value with ‘2’
- A) Multiplying
- B) Dividing
- C) Adding
- D) Subtracting
What will be the output of the following code? #include <iostream> using namespace std; struct Student { char name[10]; char grade[2]; int age; int id; }; int main() { Student s1; cout << sizeof(s1); return 0; }
- A) 16
- B) 24
- C) 20
- D) 18
What type of argument does seekg() and seekp() require to indicate the number of bytes to move?
- A) int
- B) long
- C) float
- D) char
Which of the following is a correct way to declare structure variables immediately after the structure definition? struct student { char name[60]; char address[100]; float GPA; } _______;
- A) struct std1, std2;
- B) student std1, std2;
- C) struct student std1, std2;
- D) std1, std2
The bit manipulation operator ______________ is used to set a specific bit.
- A) *
- B) &
- C) ^
- D) |
In C++, combination of ________ and _________ functions are used to determine the actual data length of a file.
- A) getc(), putc()
- B) putc(), getc()
- C) seekg(), tellg()
- D) seekp(), tellp()
Which of the following statement is true regarding structures?
- A) Variables which are part of a structure are called Member Functions
- B) All data members must have the same memory space
- C) Variables which are part of a structure are called Data Members
- D) All data members must have the same data type
What will be the output of the following code? int num = 2; int count=0; while(num!= 0) { if ( num & 01) count ++; num >>=1; } cout<< count; return 0;
- A) 2
- B) 4
- C) 1
- D) 3
What does the expression malloc(1000 * sizeof(int)) do?
- A) Allocates memory for 1000 integers
- B) Allocates memory for 1000 bytes
- C) Allocates memory for 1000 floats
- D) Allocates memory for 1000 characters
Dynamic memory allocation uses memory from the __________.
- A) Mulit-dimensional Array
- B) Stack
- C) Array
- D) Heap
Representing logical depiction of the solution to the problem is known as a ______________.
- A) Structure
- B) Sequence
- C) Flowchart
- D) Loop
Trying to use getch() function without including #include<conio.h> header file in the program is a ________ error.
- A) Logical
- B) RunTime
- C) Arithmetic
- D) Compilation
The statement char arr [10]; is an example of a type of ____________ memory allocation.
- A) Null Value
- B) Built-in
- C) Static
- D) Dynamic
To understand programming concepts, ___________ programming language is being used as a vehicle in CS201- “Introduction to Programming” course.
- A) C#
- B) Java
- C) C/C++
- D) B
What type of expression is used as the condition in a while loop?
- A) Logical expression (returns true or false)
- B) Character expression
- C) String expression
- D) Integer expression