Computer 10 Pre-Board.
Computer 10 Pre-Board.
Q. 2 A _____ loop is used to execute a set of statements repeatedly for a fixed number of times. (1)
Q. 3 Which of the following selection structures tests only for equality? (1)
Q. 5 Which of the following is used at the beginning and the end of a for loop if it consists of more than one statement? (1)
A. ( ) B. < > C. [ ] D. { }
Q. 6 Which of the following will be printed when the given code is executed? (1)
Q. 7 Which of the following structure enables a programmer to execute a set of instructions repeatedly until a particular (1)
condition is met?
Q. 8 In a situation where there are only two choices based on a condition, which of the following statement is suitable (1)
to use?
Q. 12 A _____ loop is used when it is required to execute a loop at least once. (1)
Q. 13 Which of the following loop is preferred when the number of times the loop will execute is not known in advance? (1)
else
* ;
z = x − 5 y
Q. 4 Write down the difference between while loop and do-while loop. (2)
Q. 6 Write down the difference between else-if and switch selection structures. (2)
Q. 7 Write down the difference between for loop and while loop. (2)
int n,sum=0;
for (n=1; n<=10; n+2)
{
sum=sum+n
printf("%d\t",n)
}
Q. 2 Define nested loop. Write down an example for a nested loop. (4)
Q. 4 Write down the algorithm for the series given below, with the help of the program formulated for it to compute and print (4)
sum using 'for loop' statement.
2 3 n
x + x + x +. . . + x
Q. 5 What is the purpose of a switch statement? Also, write a program to demonstrate the use of a switch statement. (4)
Q. 7 Write a program to compute and print sum of the following series using for loop statement. (4)
2 3 n
x + x + x +. . . + x