Professional Documents
Culture Documents
CS201 MCQs Mids 2024 Mam Mehwish
CS201 MCQs Mids 2024 Mam Mehwish
CS201 MCQs Mids 2024 Mam Mehwish
03184148783
Past Papers for Mids./Finals are also Available
Options:
A) 1
B) 2
C) 3
D) 0
Correct Option: A) 1
Options:
A) One time
B) Undefined times
C) Two times
D) Zero time
3. Compiler translates high level language program into _________ language code.
Options:
A) Source
B) Machine
C) Assembly
D) Object
Options:
A) Source
B) Machine
C) Human-readable
D) Assembly
5. When the if statement consists of more than one statement then enclosing these statement in braces
is _________.
Options:
A) Compulsory
B) Relevant
C) Optional
D) Not required
Options:
A) Compilation error
C) Logical error
D) Run-time error
```
void car() {
int main() {
Car();
```
Options:
A) Compilation error
B) Honda
C) Runtime error
D) Undefined behavior
8. What is the output of the following code, if the first case is true
```
switch (var)
case 'a':
cout<<”apple”<<endl;
case 'b':
cout<<”banana”<<endl;
case 'm':
cout<<”mango”<<endl;
default:
cout<<”any fruit”<<endl;
```
Options:
A) apple
Options:
A) Check equality
B) Check inequality
C) Assigning value
D) Calculating value
10. To perform repetition tasks for a known number of repetitions, most often used structure is
__________.
Options:
A) While structure
B) For structure
C) Do-while structure
- a) logical error
- d) Compilation error
- b) Function arguments
- c) Function name
- d) Function data
- a) JAVA
- c) C#
- d)
- a) DataType = VariableName;
- b) (DataType) VariableName;
- c) VariableName Datatype;
- d) DataType VariableName;
- a) Variable
- b) Number
- c) Constant
- d) Cell
6. What will be the result of the expression `k = ++m;` if initially `k = 0` and `m = 5`?
- a) 5
- b) 6
- c) 7
- d) 4
- Correct option: b) 6
8. It is the job of ________ to transfer the executable code from hard disk to main memory.
- a) Linker
- b) Debugger
- c) Loader
- d) Interpreter
9. What is the output of the following code, if the first case is true:
```cpp
switch (var)
case 'a':
cout<<”apple”<<endl;
case 'b':
cout<<”banana”<<endl;
case 'm':
cout<<”mango”<<endl;
default:
cout<<”any fruit”<<endl;
```
- a) apple
- b) banana
- c) mango
- d) any fruit
10. __________ of a variable means the locations within a program from where it can be accessed.
- a) Reference
- b) Value
- c) Data type
- d) Visibility
- a) Debugging
- b) Executing
- c) Loading
- d) Linking
2. The expression ((a + b) == 10) && ((x + y) == 20) is true only if __________________.
- Correct option: b) Both ((a + b) == 10) and ((x + y) == 20) are true
3. If x is declared as an integer, what will be the result of the given expression?
x=3*5%(2+2)/2
- a) 1
- b) 2
- c) 3
- d) 4
- Correct option: a) 1
- a) Relational
- b) Logical
- c) Arithmetic
- d) Assignment
- a) Linker
- b) Comments
- c) Compiler
- d) Debugger
- a) Assembly
- b) Machine
- c) Binary
- d) Low-level
- a) Control
- b) Sequence
- c) Repetition
- d) Selection
- a) Control
- b) Sequence
- c) Repetition
- a) Parentheses
- b) Brackets
- c) Semicolon
- a) 0
- b) 1
- c) 2
- d) 3
- Correct option: c) 2
11. _________ stops execution at the line that contains error(s) in the code.
- a) Debugger
- b) Linker
- c) Compiler
- d) Interpreter
1. Which of the following loops checks the test condition at the end of the loop?
Options:
A) While
B) For
C) Nested Loop
D) Do-While
2. According to C++ norms; the first character of a variable name must be an alphabet or ________.
Options:
A) Underscore
B) Special character
C) UnderscoreSpecial character
D) Special characterUnderscore
Options:
A) Debugging
B) Programming
C) Compilation
D) Execution
Correct Option: A) Debugging
4. If we pass more than one argument to a function then they are separated by ________.
Options:
A) Commas
B) Semicolons
C) Colons
D) Spaces
Options:
A) 9
B) 10
C) 11
D) 12
Correct Option: C) 11
Options:
Options:
A) 0
B) 1
C) 2
D) 3
Correct Option: B) 1
Options:
A) Parentheses
B) Curly braces {}
C) Square brackets []
9. The most suitable data type for the number 325.25 is ________.
Options:
A) int
B) char
C) short
D) float
Options:
A) Application software
B) Operating system
C) Utilities
D) Device drivers
- a) #
- b) $
- c) _
- d) @
- Correct option: c) _
2. _________ of a variable means the locations within a program from where it can be accessed.
- a) Data type
- b) Reference
- c) Value
- d) Visibility
- a) Integer
- b) Float
- c) Character
- d) String
- a) DataType = VariableName;
- b) (DataType) VariableName;
- c) VariableName DataType;
- d) DataType VariableName;
- a) C#
- b) JAVA
- c) JAVA
6. In the following nested For Loop, which loop will run most number of times?
```c
// ......
```
- a) Loader
- b) Compiler
- c) Debugger
- d) Linker
- b) Compilation error
- c) Run-time error
Options:
a) Application
b) Device Driver
c) Utility
d) System
Options:
Options:
a) Human
b) High-level
c) Assembly
d) Machine
Options:
a) During
b) After
c) Before
d) Along with
Options:
a) Bitwise
b) Logical
c) Relational
d) Arithmetic
Options:
a) None
b) One
c) Two
d) Many
Options:
a) Application
b) Utility
c) System
d) Device Driver
Options:
a) 16
b) 17
c) 15
d) 51
Correct option: a) 16
Options:
a) add(num);
b) add(&num);
c) add(*num);
d) add(*&num);
Options:
a) Add 2 in X value
c) None of these
d) Add 1 in X value
- A) *=
- B) =
- C) ==
- D) ===
- Correct Option: C) ==
- A) 9
- B) 10
- C) 11
- D) 12
- Correct Option: C) 11
- A) 5
- B) 6
- C) 7
- D) 8
- Correct Option: B) 6
4. __________ will be used for clarity and to force the order of evaluation in an expression.
- A) Brackets {}
- B) Apostrophes ''
- C) Parentheses ()
- A) 14
- B) 15
- C) 16
- D) 17
- Correct Option: C) 16
- A) 0 times
- B) 1 time
- C) 2 times
- D) Infinite times
- A) before
- B) after
- C) during
- D) parallel to
- A) x is greater than 3
- B) Difficult to compile
- D) Easy to understand
- A) continue
- B) break
- C) goto
- D) Multiple if
- A) Device drivers
- B) Utilities
- C) Operating system
- D) System Software
```cpp
int value = 1;
switch (value+value){
case 1 :
break;
case 2 :
default :
```
- A) Punjab
- B) Lahore
- C) Pakistan
`10 + (6 / 2) – 2 * 3`
- A) Addition
- B) Division
- C) Multiplication
- D) Subtraction
4. What will be the values of variables x and y after executing the following code if x = 33 and y = 19?
```cpp
if(x % y != 0)
x++;
y--;
```
- A) x = 33, y = 19
- B) x = 34, y = 18
- C) x = 32, y = 20
- D) x = 34, y = 19
5. From given options, select the correct syntax of the “function call” to the following function.
- A) add(&x);
- B) add (*x);
- C) add(int x);
- D) add(x);
- A) integer
- B) int
- C) character
- D) doubles
```cpp
if (x = 10)
```
- A) Debugger
- B) Comments
- C) Linker
- D) Compiler
10. What will be the correct output for the given program?
```cpp
int num = 1;
switch ()
case 1 :
break;
default :
```
- A) 15
- B) 20
- a) 10
- b) 11 (Correct)
- c) 12
- d) 9
2. If we assign 2.06721 to an integer variable x, what will be the output if we print x using cout<<x;
statement?
- a) 2.06721
- b) 2.0
- c) 2 (Correct)
- d) 3
- a) 1
- b) 2 (Correct)
- c) 3
- d) 4
- a) _studentNameNameOfStudent
- b) NameOfStudent
- c) @studentName
- d) nameOfStudent (Correct)
- b) Assembly
- c) Low-level
- d) Source
- a) Logical
- b) Arithmetic (Correct)
- c) Arithmetic
- d) Relational
- a) 1 (Correct)
- b) 2
- c) 4
- d) 8
- a) if statement
- b) while loop
- c) do-while loop
- d) goto (Correct)
- a) Device drivers
- b) Device drivers
- d) Operating system
10. While loop becomes infinite in which scenario _______.
- To display message
2. If we pass more than one argument to a function then they are separated by _________.
- Double quotes
- Colon
- Semicolon
- Comma (Correct)
- Complex to understand
- Difficult to compile
- Reference, Reference
- Value, Reference
- Reference, Value
- Logical
- Relational (Correct)
- Conational
- Arithmetic
```cpp
if ( num % 2 != 0)
continue;
```
Options:
- 2 3 4 5'
- 2 3 4 5 (Correct)
-24
X = 50 / ( 2 % 2 ) + 9
```
Options:
```cpp
x=3*5%(2+2)/2
```
Options:
- 0 (Correct)
-3
-1
-5
```cpp
void car() {
int main() {
Car();
```
Options:
- CarHonda
- Honda
- Honda car
A. 1
B. 2
C. 0
D. 3
Correct Option: A. 1
2. According to C++ norms, the first character of a variable name must be an alphabet or ________.
A. Special character
B. Underscore
C. Digit
A. goto
B. break
C. return
D. None of these
A. value
B. name
C. address
D. None of these
A. Add 1 in X value
C. None of these
D. Add 2 in X value
8. If we pass more than one arguments to a function then they are separated by ________.
A. Period
B. Colon
C. Semicolon
D. Comma
A. 2
B. 3
C. 1
D. 4
Correct Option: C. 1
A. 2
B. 1
C. 0
D. Many
Correct Option: B. 1
- a) if
- b) else
- c) Functions
- d) Loops
- a) 0
- b) 1
- c) 2
- d) 3
- Correct option: c) 2
3. ________ of a variable means the locations within a program from where it can be accessed.
- a) Visibility
- b) Reference
- c) Value
- d) Data type
4. A repetition statement specifies that an action is to be continued while some_______ remains true.
- a) Control
- b) Operator
- c) Condition
- d) Assignment
- a) int
- b) float
- c) double
- d) char
- a) Equal
- b) Greater than
- c) Less than
- d) Not equal
8. Continue statement usually forces the immediate _____ iteration of the loop.
- a) Next
- b) Previous
- c) Final
- d) Last
9. When the logical operator OR (||) combine two expressions exp1 and exp2 then the result will be
false only,
10. When the if statement consists of more than one statement then enclosing these statement in
braces is _________.
- a) Not required
- b) Compulsory
- c) Relevant
- d) Optional
- Correct option: b) Compulsory
- Arithmetic
- Relational
- Logical
- Conational
- Sequential
- SequentialDecision
- None of these
- Add 1 in X value
- Add 2 in X value
- Address
- Data type
- Value
- Name
- Compiler
- Loader
- Debugger
- Linker
- Logical
- Arithmetic
- Relational
- Mathematical
- Functionality
- Performance
- Reliability
- Consistency
- Coding
- Linking
- Analysis
- Compiling
- Program
- Statement
- Algorithm
Options:
A) Assignment operators
C) Unary operator
D) Logical operator
```cpp
If (x = 10)
```
Options:
Options:
A) j will be 5
B) j will be 6
C) j will be 4
D) j will be 0
```cpp
int value = 1;
switch (value+value){
case 1 :
break;
case 2 :
break;
default :
```
Options:
A) Punjab
B) Lahore
C) Pakistan
5. A variable declared within a code block becomes ________ variable for that block.
Options:
A) Static
B) Local
C) Integer
D) Global
Options:
A) Low level
B) High level
C) Machine
D) Assembly language
```cpp
if ( num % 2 != 0)
continue;
```
Options:
A) 3 4 5
B) 4 5
C) 4
Correct Option: C) 4
A) k will be 5
B) k will be 6
C) k will be 4
D) k will be 0
9. _________ statement is used to terminate the processing of a particular case and exit from switch
structure.
Options:
A) break
B) goto
C) if
D) continue
10. For breaking complex problems into smaller pieces we use _______.
Options:
A) Functions
B) Break statement
C) if/else
D) Loops
```cpp
cout << i;
}
```
Options:
A. 55
B. 56
C. 66
D. 57
Correct Option: C. 66
2. Which of the following is the correct operator to compare the values of two variables?
Options:
A. =
B. ==
C. :=
D. ===
Correct Option: B. ==
Options:
A. 20
B. 24
C. 36
D. 42
Correct Option: D. 42
Options:
A. Do-while
B. For
C. While
D. If
```cpp
if (num % 2 != 0)
continue;
```
Options:
A. 3
B. 4
C. 4 5
D. 5
Correct Option: B. 4
6. For the given function prototype, which of the given function calls is appropriate/correct.
Options:
A. add(&x);
B. add(int x);
C. add(*x);
D. add(x);
int value = 1;
switch (value+value){
case 1 :
break;
case 2 :
break;
default :
```
Options:
A. Punjab
B. Lahore
C. LahorePakistan
D. Pakistan
Options:
A. Logical operator
C. Unary operator
D. Assignment operators
A. x is equal to 3
B. x is less than 3
C. x is greater than 3
10. In while loop, the condition is checked ______ the execution of loop.
Options:
A. During
B. After
C. Before
A. 20 (Correct)
A. 11
B. 16 (Correct)
C. 15
D. 12
3. If (a > b && a > c), then the condition will be true __________.
```
switch (var)
case 'a':
cout<<"apple"<<endl;
case 'b':
cout<<"banana"<<endl;
case 'm':
cout<<"mango"<<endl;
default:
cout<<"any fruit"<<endl;
```
A. mangomango
C. Syntax Error
D. mangomango (Correct)
A. 0
B. 2
C. 1 (Correct)
D. 4
A. int (Correct)
B. string
C. void
D. class
```
void car() {
int main() {
Car();
```
A. Honda car
B. Syntax Error
C. Honda (Correct)
```
void car() {
int main() {
Car();
```
A. Honda car
C. Honda
A. =
B. == (Correct)
C. >
D. <
10. According to C++ norms, the first character of a variable name must be an alphabet or __________ .
A. Special character
C. Digit
D. Underscore (Correct)
Options:
Correct Option: A
Options:
A. Utilities
B. Device drivers
C. Operating system
D. Application software
Correct Option: D
A. 16
B. 17
C. 15
D. 18
Correct Option: A
4. Which of the following is the correct operator to compare the values of two variables?
Options:
A. =
B. *=
C. ===
Correct Option: C
5. Default mechanism of calling a function by passing it array is call by ________ and in case of passing
variable is call by ________.
Options:
A. Value, Value
B. Value, Reference
C. Reference, Reference
D. Reference, Value
Correct Option: B
6. When the logical operator AND (&&) combines two expressions exp1 and exp2 then the result will be
true only, _______________.
Options:
Correct Option: B
x=3*5%(2+2)/2
Options:
A. 1
B. 2
C. 3
D. 4
Correct Option: B
Options:
A. One byte
B. Two bytes
C. Four bytes
D. Eight bytes
Correct Option: A
Options:
A. output
B. return
C. goto
D. break
Correct Option: B
A. Implementing
B. Designing
C. Programming
D. Compiling
Correct Option: C
Options:
A) 15
B) 16
C) 17
D) 18
Correct option: B) 16
2. Which one of the following languages has been used to write the compiler of “C” language?
Options:
A) Fortran
B) C
C) Java
D) Basic
Correct option: B) C
Options:
A) Continue statement
B) Goto statement
C) Default statement
D) Switch statement
Correct option: B) Goto statement
4. It is the job of ________ to transfer the executable code from hard disk to main memory.
Options:
A) Debugger
B) Loader
C) Linker
D) Interpreter
Options:
C) Reading, Writing
D) Analytical, Writing
Options:
A) Underscore
B) Plus
C) Colon
D) Semicolon
```cpp
int j = 3;
while(j > 0)
j -= 2;
```
Options:
A) 0
B) 1
C) 2
D) Infinite loop
Correct option: C) 2
8. If
```cpp
int a = 17;
int b = 3;
double c = a / b;
```
Options:
A) 5.0
B) 5
C) 6
D) 6.0
Options:
A) (*, -, /, +)
10. ___________ are used to translate the code of our program into machine language.
Options:
A) Debuggers
B) Compilers
C) Linkers
D) Editors
💎Agr complete handling krwatey hain 1 subject ki with all activities= Rs 500 (Half
Semester) 💎
🔥 Miss Mehwish:03184148783🔥