0% found this document useful (0 votes)
58 views

Punjab College Gujrat - Girls Campus: Predict The Output of The Following Code. 2x4 8 Question #1 Question #2

This document contains a practice exam for a Computer Science course. It has 4 multiple choice questions that assess the student's ability to predict code output, trace errors, and identify valid/invalid identifiers. It also contains short answer questions about type casting, variable declaration/initialization, comments, operators, and logical operators. The exam is out of 40 total marks.

Uploaded by

Nida Butt
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)
58 views

Punjab College Gujrat - Girls Campus: Predict The Output of The Following Code. 2x4 8 Question #1 Question #2

This document contains a practice exam for a Computer Science course. It has 4 multiple choice questions that assess the student's ability to predict code output, trace errors, and identify valid/invalid identifiers. It also contains short answer questions about type casting, variable declaration/initialization, comments, operators, and logical operators. The exam is out of 40 total marks.

Uploaded by

Nida Butt
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/ 3

Computer Science

I.C.S

Punjab College Gujrat Girls Campus


Time Allowed: 40mins

Student Name:
Section:

_____________
_____________

Date:
Marks:

_____________

Predict the output of the following code. 2x4=8


Question #1
void main()
{
int age;
age=10;
printf(" Welcome!\n");
printf(" You are able to test your
skill of writing C code here.\n");
getch();
}

Question #3
{
intnum=15;
num+=5
num*=2;
printf(value of num is
%d,num);
}

Trace the errors in the program.2x4=8

Question #2
void main()
{
int x=10;
int y=15;
float z=12.6;
printf("x= %d \t",x);
printf("y=%d \t",y);
printf("z=%3.1f",z);
printf("\n");
getch();
}

Question#4
#include<stdio.h>
void main()
{
int x;
x= -2 + 11 - 7 * 9 % 6 / 12;
printf("%d",x);
getch() ;
}

Computer Science
I.C.S

Question#1

Correction:

void main()
{
int = 10 ;
char = d
k=d+d;
printf(%d,k);
}

Question#2

Correction:

void main()
{
intx= 10 ;
x+5=y
Printf(%d,y);
}

Question#3

Correction:

void main();
{
int n ;
scanf(%f.k);
float sum=n+k;
printf(%d,sum);
}

i.

$cash

ii.

Total Marks

iii.
iv.
v.

Room#
_num
1.var

Identify the valid and invalid identifier from the above.


Briefly answer the following questions. 2x5
i.
What is difference between implicit and explicit type casting?
ii.
Rewrite expression in c language a=6b4?
ii.
Define variable declaration and initialization.
iii.
What is compound assignment statement.
iv. Describe coments in C.
What are operators? Explain logical operators.
(08)

Computer Science
I.C.S

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy