MCQ’s
Chapter 4 – Data and Repetition

Data and Repetition – MCQ’s

Choose the correct answer

1. ________ is a group of consecutive memory locations with same name and data type.
a. Simple variable b. Scalar value c. Array d. Structure
2. Which of the following is correct declaration of array?
a. int arr; b. int arr{10}; c. int arr[10]; d. int arr(10);
3. What is the index number of last element of an array with 5 elements?
a. 5 b. 4 c. 0 d. 6
4. Which of the following identifies first element in array named temp?
a. temp[0] b. temp[1] c. temp(1) d. temp(0)
5. Each element of array has its own:
a. Member name b. Index c. Upper bound d. Size
6. The total number of elements in an array is called _______ of the array.
a. Index b. Size c. Upper bound d. Limit
7. The index of an element in array is written within:
a. Angle brackets <> b. Square brackets [] c. Parentheses ( ) d. Curly brackets {}
8. Which of the following is used to access a specific element of an array?
a. Dot operator b. Index c. Member name d. None

» View More

9. The index of first element of an array is always:
a. 0 b. 2 c. 4 d. 1
10. What is the representation of the third element in an array called n?
a. n[2] b. n[3] c. n[1] d. n[4] 11. Each element in array has:
a. Symbol b. unique index c. Data type d. Order
12. Given the following declaration, where is 77 stored in the n array?
int n[]={83, 62, 77, 97};
a. n[0] b. n[1] c. n[2] d. n[4] 13. How many elements does the following array have?
int n[1000];
a. 1000 b. 998 c. 0 d. 999
14. What is the output of the following code segment?
int n[4] = {8, 7, 6, 3};
printf(“%d”, n[3]);
a. 0 b. -1 c. 1 d. 3
15. What is the output of the following code segment?
int n[] = {56, 90, 86, 97, 120};
printf(“%d”, n[3]);
a. 97 b. 86 c. 120 d. 90
16. Which control structure in C is used to repeat a set of statements?
a. Selection b. Loop c. Sequential d. None
17. How many types of loop structure are available in C?
a. 4 b. 3 c. 2 d. 6
18. Each run of a loop is called:
a. Cycle b. Duration c. Iteration d. Test
19. Which of the following loop is not available in C language?
a. while b. do-while c. for d. wend
20. Which of the following is a loop statement?
a. if b. if-else c. switch d. for
21. The statements within curly braces in a loop is known as loop:
a. Body b. Title c. Header d. Center
22. The number of expressions in for loop is:
a. 1 b. 3 C. 2 d. 4
23. The for loop contains three expressions: initialization, condition and:
a. Assignment b. Validation
c. Increment/decrement d. Recalling
24. There are three expressions in for loop statement separated by:
a. , (Comma) b. : (Colon) c. ; (Semicolon) d. . (Period)
25. In for statement, this expression is executed only once:
a. Condition b. Validation c. Initialization d. All
26. What is the final value of x after executing the following code?
for (int x=0; x<10; x++)
a. 10 b. 9 c. 0 d. 1
27. What is the final value of x after executing the following code?
for(x=1; x<=3; x++)
a. 1 b. 2 c. 3 d. 4
28. A loop within a loop is called:
a. Nested Loop b. Complex loop c. Infinite loop d. Dual loop
29. A loop becomes _________ if a condition never becomes false.
a. Infinite loop b. Running loop c. Continuous loop d. Nested loop
30. The loop which never ends is called:
a. Infinite loop b. Running loop c. Continuous loop d. Nested loop

Answers
1. c 2. c 3. b 4. a 5. b 6. b
7. b 8. b 9. a 10. a 11. b 12. c
13. a 14. d 15. a 16. b 17. b 18. c
19. d 20. d 21. a 22. b 23. c 24. c
25. c 26. a 27. d 28. a 29. a 30. a

» View Less

Useful? Share with your friends.

Leave a Reply