Sei sulla pagina 1di 1

Punjab Colleges Sargodha

Exam:_Monthly Test-
Date: __________________
Roll No: ___________
Computer (Part-II) Max Marks: _____20___
Class: _____________ _________________

Q1: Select the correct option? (4 * 1 = 4) A B C D


Write correct
option
1. Which of the statement is used to move control 1
to the start of loop body 2
a. continue b. break 3
c. switch d. none of these 4

2. In a for statement, this expression is executed only once:


a. Test b. validation
c. initialization d. None of these

3. Semicolon is placed at the end of condition in:


a. While Loop b. do-while loop
c. for loop d. all of these

4. This statement is used to stop a loops current iteration and begin next one:
a. continue b. break
c. terminate d. none of these

Q2: Write the short answers of the followings? (4 * 2 = 8)


1. What is sentinel value?
2. Differentiate between counter and conditional loops?
3. What will be the output of the following code:
#include<stdio.h>
Void main()
{ Int i;
For (i = 10 ; i > 0 ; i = i 1)
{ If (i % 2 ! = 0 )
Printf(i = %d \n,i);
Else
Continue; } }
4. What is goto statement ? write its general form?

Q3: Write a program that calculate and display the sum of the following series using
for loop: X + X2 + X3 Xn

Potrebbero piacerti anche