10. ................ can be thought of as container to store constants.
a. Box
b. Jar
c. Variable
d. Collection
Answer: c. Variable
11. Let the following part of code, what will be the value of the variable a after execution?
int a = 4;
float b = 2.2;
a = a * b;
a. 8.8
b. 8
c. 8.0
d. 8.2
Answer: b. 8
12. Which of the following is a valid line of code?
a. Int = 20;
b. grade = 'A'
c. Line = this is a line
d. None of these
Answer: b. grade = 'A'
13. What is true about C language?
a. C is not a case sensitive language
b. Keywords can be used as variables
c. All logical operators are binary operators
d. None of these
Answer: d. None of these
From the following ........... is a valid character.
a. "here"
b. "C Language"
c. "a"
d. ’a’
Answer: c. "a"
51. Which of following is a valid character?
a. ’here’
b. "a"
c. ’9’
d. "abc"
Answer: c. ’9’
52. ............. are the values that do not change during the whole execution of program.
a. Variables
b. Constants
c. Strings
d. Comments
Answer: b. Constants
53. From the following ........ is a valid line of code.
a. int = 20
b. grade = ’A’
c. line = this is line
d. float = 10
Answer: b. grade = ’A’
54. For initialize a variable, we use ........... operator.
a. →
b. =
c. @
d. ?
Answer: b. =
55. A float uses .......... bytes of memory.
a. 3
b. 4
c. 5
d. 2
Answer: b. 4
Chapter-2
14. Which operator has highest precedence among the following?
a. /
b. =
c. >
d. !
Answer: d. !
15. Which of the following is not a type of the operator?
a. Arithmetic operator
b. Relational operator
c. Check operator
d. Logical operator
Answer: c. Check operator
16. The operator % is used to calculate .................
a. Percentage
b. Remainder
c. Factorial
d. Square
Answer: b. Remainder
17. Which of the following is the condition to check a is a factor of c?
a. A % c == 0
b. C % a == 0
c. A * c == 0
d. A + c == 0
Answer: b. C % a == 0
Chapter-3
18. Conditional logic helps in ...............
a. Decisions
b. Iterations
c. Traversing
d. All of these
Answer: a. Decisions
19. ................. statements describe the sequence in which statements of the program should be executed.
a. Loop
b. Conditional
c. Control
d. All of these
Answer: c. Control
20. In if statement, what happens if condition is false?
a. Program crashes
b. Index out of bound error
c. Further code executes
d. Compiler asks to change condition
Answer: c. Further code executes
21. Which of the following statements will execute?
int a = 5;
if (a < 10)
a++;
else
if (a > 4)
a--;
a. A++;
b. A--;
c. Both A and B
d. None of these
Answer: a. A++;
22. A condition can be any ................ expression.
a. Arithmetic
b. Logical
c. Relational
d. All of these
Answer: d. All of these
23. An if statement inside another if statement is called ............ structure.
a. Nested
b. Boxed
c. Repeated
d. Decomposed
Answer: a. Nested
24. A set of multiple instructions enclosed in braces is called a ...............
a. Box
b. List
c. Block
d. Job
Answer: c. Block
25. .................... structure allows repetition of a set of instructions.
a. Loop
b. Conditional
c. Control
d. Data
Answer: a. Loop
Assalamo Alaikum!
Respected Students. The belows mcqs are random but these are from your test syllabus.
Just due to lack of time, I am doing this.
For next time preparation you will see proper adjustment of these mcqs according to chapter wise.
Random Mcqs
1. Include statements are written in section.
a. Header
b. Main
c. Comments
d. Prints
Answer: a. Header
2. From the following is a valid character.
a. "here"
b. "C Language"
c. "a"
d. ’a’
Answer: d. 'a'
3. For initialize a variable, we use operator.
a. →
b. =
c. @
d. ?
Answer: b. =
4. A float uses bytes of memory.
a. 3
b. 4
c. 5
d. 2
Answer: b. 4
5. A char uses bytes of memory.
a. 1
b. 2
c. 3
d. 4
Answer: a. 1
6. What will be the output of code?
void main() { printf("1 "); }
a. "1"
b. "2"
c. 1
d. 2
Answer: c. 1
7. It is a very common mistake to forget operator in the scanf function.
a. &
b. %
c. *
d. $
Answer: a. &
8. What will be the output of the following?
void main() { printf("Pakistan"); }
a. Punjab
b. Pak
c. Pakistan
d. Pun
Answer: c. Pakistan
9. Among the following operator has the lowest precedence.
a. /
b. =
c. <
d. !
Answer: b. =
10. What will be the value of variable "a" after execution of the following part of code?
int a = 4;
float b = 2.2;
a = a * b;
a. 8
b. 8.0
c. 8.8
d. 8.2
Answer: a. 8
11. The Operator that Operates on three Operands is called:
a. Unary Operator
b. Binary Operator
c. Ternary Operator
d. Tetra Operator
Answer: c. Ternary Operator
12. A selection statement within another selection statement is called selection structure.
a. Nested
b. Dual
c. Infinite
d. Complex
Answer: a. Nested
13. In if statement, what happens if condition is false?
a. Program crashes
b. Index out of bound
c. Further code executes
d. Compiler asks to change condition
Answer: c. Further code executes
14. Which of the following is the condition to check a is factor of c?
a. a % c == 0
b. c % a == 0
c. a * c == 0
d. a + c == 0
Answer: b. c % a == 0
15. A list of words that are predefined and must not be used by the programmer to name his own variables are known as:
a. Auto words
b. Reserved words
c. Restricted words
d. Predefined words
Answer: b. Reserved words
16. Which of the following keyword used for store integer data type:
a. float
b. char
c. int
d. Void
Answer: c. int
17. Printf() is used to print type of data:
a. int
b. float
c. char
d. All of these
Answer: d. All of these
18. There are ------ type of logical operators in C-language.
a. 2
b. 3
c. 4
d. 5
Answer: b. 3
19. Which of the following is True about C-Language:
a. C is not a Case Sensitive Language
b. Keywords can be used as variable names
c. All Logical Operators are Binary Operators
d. None of these
Answer: d. None of these
20. What is the output of the following code?
int x = 10;
if (x > 10) printf("Wrong"); else printf("Correct");
a. Wrong
b. Correct
c. Error
d. No output
Answer: b. Correct