MCQ Bank
Functions seekg () and seekp () require an argument of type ____ to let them know how many bytes to move forward or backward.
- A) long
- B) double
- C) int
- D) float
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) Private
- D) Protected
In C++, combination of ________ and _________ functions are used to determine the actual data length of a file.
- A) seekg(), tellg()
- B) seekp(), tellp()
- C) getc(), putc()
- D) putc(), getc()
What type of argument does seekg() and seekp() require to indicate the number of bytes to move?
- A) long
- B) float
- C) char
- D) int
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) 1
- B) 3
- C) 4
- D) 2
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 student std1, std2;
- B) student std1, std2;
- C) std1, std2
- D) struct std1, std2;
In C++, which operator is used while accessing through the pointer to structure?
- A) _
- B) ->
- C) =
- D) &
Which of the following statement is true regarding structures?
- A) Variables which are part of a structure are called Member Functions
- B) Variables which are part of a structure are called Data Members
- C) All data members must have the same data type
- D) All data members must have the same memory space
In bit manipulation of binary systems, if we shift a bit towards right then it means we are ______________ that binary value with ‘2’
- A) Adding
- B) Multiplying
- C) Subtracting
- D) Dividing
The bit manipulation operator ______________ is used to set a specific bit.
- A) *
- B) |
- C) &
- D) ^
In C++, __________ function is used to write a character into a file while _______ is used to get a character from a file.
- A) seekg(), tellg()
- B) getc(), putc()
- C) tellg(), seekg()
- D) putc(), getc()
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) 18
- B) 24
- C) 20
- D) 16
Representing logical depiction of the solution to the problem is known as a ______________.
- A) Sequence
- B) Structure
- C) Loop
- D) Flowchart
What type of expression is used as the condition in a while loop?
- A) Integer expression
- B) String expression
- C) Logical expression (returns true or false)
- D) Character expression
To understand programming concepts, ___________ programming language is being used as a vehicle in CS201- “Introduction to Programming” course.
- A) Java
- B) B
- C) C/C++
- D) C#
Trying to use getch() function without including #include<conio.h> header file in the program is a ________ error.
- A) Arithmetic
- B) RunTime
- C) Compilation
- D) Logical
What is the purpose of using && in an if condition?
- A) To end the if block
- B) To combine two conditions where both must be true
- C) To check equality
- D) To combine two conditions where at least one must be true
What will happen if the outer if condition in a nested if statement is false?
- A) Only the else block of the inner if is executed
- B) It causes a syntax error
- C) The inner if is still checked
- D) The program skips the entire block
___________ is a useful statement when at a certain stage you do not want to execute the remaining statements inside the loop and want to go to the first statement of loop.
- A) Goto
- B) Break
- C) Continue
- D) Default