0% found this document useful (0 votes)
19 views1 page

Chapter 12

This document is an exam paper for 2nd Year Computer Science students at Pak Garrison Higher Secondary School. It contains programming questions requiring students to write code for various tasks, including displaying even and odd numbers, generating specific outputs, and producing multiplication tables. Additionally, there are short answer questions related to code output predictions and loop behavior.

Uploaded by

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

Chapter 12

This document is an exam paper for 2nd Year Computer Science students at Pak Garrison Higher Secondary School. It contains programming questions requiring students to write code for various tasks, including displaying even and odd numbers, generating specific outputs, and producing multiplication tables. Additionally, there are short answer questions related to code output predictions and loop behavior.

Uploaded by

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

PAK GARRISON HIGHER SECONDARY SCHOOL

Housing Colony Nankana Sahib

Class: 2nd Year Computer Science Maximum Marks: 60

Student Name:
Roll Number: ___________ Date of Paper: 11-03-2025
_______________

Section: ___________ Paper Type: Programs + Output Time Allowed: 20min

Q1. Write detailed answers of the following questions. (5X10=50)


1. Write the a program that displays the first 15 even numbers.
2. Write a program that prints all odd positive integers less than 100 skipping those that are exactly divisible by 7.
3. Write down a program that produces the following output:
11
28
4 64
8 512
16 4096
32 32768
4. Write a program in C language that inputs a number, and displays its table according to the following for seemat:
Suppose the number entered is 5, the output will be as follows:
5*1=5
5*2=10
5*3=15
:
5*10=5
Q2. Write down short answers of following questions. (5X2=10)
[i]‫ ـ‬What is the output of the following code segment?
int x=3;
while(x<9)
{
printf("x is %d ",x);
x+=2;
}
[ii]‫ ـ‬Predict the output of the following piece of code.
int a=2;
while(a<=6)
{
printf(" a=%d",a);
a+=1;
}
[iii]‫ ـ‬How many times the following loop display "welcome"?
for(i=12;i>0;i--)
printf("welcome");
[iv]‫ ـ‬Trace the output following code
n=0;
while(n<=4)
{
printf("%3d%3d ",n,10-n);
n++;
)
[v]‫ ـ‬Determine output of following code:
int i;
i=10;
while (i<=10) {
printf (" %d", i);
i++;
}

You might also like