T4Tutorials .PK

VU Past Papers CS201-Important MCQs

Q#1: What is the correct syntax to declare an array of 15 elements of type float?
(A) float arr[15];
(B) float arr();
(C) float arr{};
(D) arr float[15];
Answer: (A) float arr[15];

Q#2: From the following, which one is the range of Random number generator function rand()?
(A) 0 to 32767
(B) 0 to 255
(C) 1 to 100
(D) -32768 to 32767
Answer: (A) 0 to 32767

Q#3: When number of repetitions is known, then we use the ___ structure to perform repetition tasks.
(A) for loop
(B) while loop
(C) do-while loop
(D) if statement
Answer: (A) for loop

Q#4: Loops are ___ structure.
(A) Decision
(B) Repetition
(C) Sequential
(D) Jump
Answer: (B) Repetition

Q#5: When the break statement is encountered in a loop’s body, it transfers the control ___ from the current loop.
(A) to next iteration
(B) out of the loop
(C) to start of loop
(D) to a function
Answer: (B) out of the loop

Q#6: By default, the starting index of an array in C++ is ___
(A) 1
(B) -1
(C) 0
(D) Depends on declaration
Answer: (C) 0

Q#7: A while loop may execute ___ or more times.
(A) One
(B) Zero
(C) Two
(D) Infinite
Answer: (B) Zero

Q#8: In C/C++, by default arguments are passed by ___ to a function.
(A) Reference
(B) Value
(C) Address
(D) Pointer
Answer: (B) Value

Q#9: If we pass more than one argument to a function, they are separated by ___
(A) Semicolon ;
(B) Colon :
(C) Comma ,
(D) Space
Answer: (C) Comma ,

Q#10: Which of the following function call is “call by reference” for the function prototype int add(int *);
(A) add(&x);
(B) add(x);
(C) add(*x);
(D) add(int x);
Answer: (A) add(&x);

Q#11: ___ statement is used to terminate the processing of a particular case and exit from switch structure.
(A) if
(B) break
(C) goto
(D) continue
Answer: (B) break

Q#14: Using a segment of source code again by adding new functionalities with slight or no modification is termed as ___
(A) Code reuse
(B) Code modification
(C) Inheritance
(D) Polymorphism
Answer: (B) Code modification

Q#15: While loop becomes infinite in which scenario?
(A) Condition always true
(B) Condition always false
(C) Loop body empty
(D) Loop body with break
Answer: (A) Condition always true

Q#16: ___ are used to compile the code.
(A) Loader
(B) Compiler
(C) Linker
(D) Editor
Answer: (B) Compiler

Q#17: In do-while loop, the condition is checked ___ one execution of loop.
(A) before
(B) after
(C) during
(D) never
Answer: (B) after

Q#18: Which of the following will be the most appropriate data type to store the value 63.547?
(A) int
(B) float
(C) double
(D) char
Answer: (B) float

Q#19: The result of 4 % 3 will be:
(A) 1
(B) 3
(C) 0
(D) 4
Answer: (A) 1

Q#20: It is the job of ___ to transfer the executable code from hard disk to main memory.
(A) Compiler
(B) Loader
(C) Editor
(D) Linker
Answer: (B) Loader

Q#21: Compiler translates high level language program into ___ language code.
(A) Assembly
(B) Machine
(C) Binary
(D) Object
Answer: (B) Machine

Q#22: In call by reference, ___ of a variable is passed to the called function.
(A) Value
(B) Address
(C) Name
(D) Data type
Answer: (B) Address

Q#23: What will be the output of the following while loop?

int counter = 0;
while(counter < 15) {
  cout << counter << ” “;
  counter++;
}

(A) Compile time error
(B) 0 1 2 … 14
(C) 0 1 2 … 15
(D) Infinite loop
Answer: (B) 0 1 2 … 14

Q#24: ___ loop executes at least one time.
(A) for
(B) while
(C) do-while
(D) if
Answer: (C) do-while

Q#25: In which language the compiler of C language is written?
(A) C
(B) C++
(C) Assembly
(D) Java
Answer: (A) C

Q#26: According to C++ norms, the first character of a variable name must be ___
(A) Alphabet or Special character
(B) Alphabet or digit
(C) Digit
(D) Underscore only
Answer: (A) Alphabet or Special character

Exit mobile version