0% found this document useful (0 votes)
14 views2 pages

Chapter 12 Paper

computer science 12th class chapter 12 paper

Uploaded by

chmuhammadraees
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Chapter 12 Paper

computer science 12th class chapter 12 paper

Uploaded by

chmuhammadraees
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Teacher Name: Muhammad Raees

Name: Total Marks: 75 Class: 2nd year ICS


Chapter No: 12 Paper: computer
Time Allowed: 10 Minutes
(OBJECTIVE PART)
Q No.1: Choose the correct answer. Max Marks:10*2=20
1) A loop within a loop is called?
a) Nested loop b) inner loop c) outer loop d) none of these
2) This statement causes a loop to terminate early?
a) Exit b) terminate c) break d) all of these
3) One execution of loop is known as?
a) Iteration b) cycle c) circle d) duration
4) While loop is also called?
a) Counter loop b) conditional loop c) wend loop d) iteration
5) Semi colon is placed at the end of condition in?
a) Switch b) for loop c) while loop d) do while loop
6) Which is a loop statements?
a) If b) if-else c) switch d) do-while
7) How many type of loops structure are available in C?
a) 4 b)3 c)2 d)6
8) In while loop the loop variable is always initialized?
a) Outside the program b) inside the loop body c) after loop ends d) outside the
body of loop
9) This statement causes the loop to terminate early?
a) Break b) Terminate c) Exit d) End
10) A loop which never ends is called?
a) Running loop b) continuous loop c) Nested loop d) infinite loop

Time: 02:10 Hours SUBJECTIVE


Q.2 Write short answers of any six parts of the following. 10*3=30
1) What if for ( ) loop? Write its syntax with example.
2) Define nested loop?
3) Why sentinel value is used in loop?
4) Define post- test loop?
5) Define infinite loop?
6) What is counter controlled loop?
7) Write the output of the following code?
Int i, j=3:
For(i=1; i<5; i++)
Printf(“\n%d%d” , i,j);
8) Write the output
Int x=5, y=3;
Do
{
x=x*2;
y=y+2;
}
While (y<7)
Printf(“%d”,x);

9) Convert following loop code into while loop code


For(i=10; i>0; i--)
{
Printf(“i=%d”, i);
}
10) Convert the following code into while loop;
For (int i=1; i<10; i++)
{
Printf( “ /npakistan”);
}

Long Questions 20
1) What is nested loop? Give its syntax. Explain its working with an example?
2) Define “for” loop. Write its syntax, draw flow chart and explain its working with the help of
example.
3) Write a program that display first five numbers and their sum using while loop.
4) Write a program which prints natural numbers from 1 to 100.
5) Write a program that display first ten odd numbers using do-while loop.
6) Write a program that displays the following block using nested for loop.
*****
*****
*****
*****
*****
7) Write a program that display the following shape using nested for loops.
*
**
***
****
*****
8) Write a program that display the following using do-while loop.
4 4 4 4
3 3 3
2 2
1

9) Write a program to produce the following output:


0
0 1
0 1 4
0 1 4 9
0 1 4 9 16
0 1 4 9 16 25

You might also like