10th Computer Ch4 2nd Half
10th Computer Ch4 2nd Half
MAIN SUI GAS ROAD NEAR NADRA OFFICE SHARAQPUR KHURD KOT ABDUL MALIK
Student Name Roll Num Class Name Paper Code
10TH
Computer 30
Exam Syllabus
1. How many times the word "PAKISTAN" will be printed through the loop? (A) 5 (B) 4 (C) 3 (D) 1
for(int a = 0 ; a < = 3 ; a + +)
{
printf("PAKISTAN");
}
2. Loop within a loop is called ...... (A) For loop (B) While loop (C) (D) Nested loop
do while loop
3. Using loops, we can easily take ...... in arrays. (A) output (B) input (C) variable (D) constant
4. We can use if structures inside ...... structure in any imaginable (A) if (B) if else (C) if else if (D) loop
manners.
5. Always make sure that the ...... becomes false at some point. (A) Loop (B) Condition (C) Variable (D) Constant
6. C language provides ...... kind of loop structure. (A) 3 (B) 4 (C) 5 (D) 6
I . Define nested loop structure. II . Write a program that displays the table of 2.
III . Identify the errors in the following code segment. IV . Write general syntax of nested loop.
int count = 0;
for(inti = 4; i<6; i--)
for(int j = i, j < 45; j++)
{
count++;
printf("%count", count);
}
V . Write down output of the following code segment. VI . Write a program that assigns first 5 multiples of 23 to an array of size
for (int 1 = 50; i<= 50; i++) 5.
{
for(j = i; j >= 48; j--)
printf("j = %d \n", j);
printf("i = %d\n", i);
}
VII . Write a program to display the following pattern of stars on screen.
*
**
***
****
*****
******
1. Write a program that calculates the factorial of a number input by user. 2. Write a program to display prime numbers ranging from 2 to 100.