Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Start time: 11:00 End Time: 1:00 PM

Email: abbaskhalid.ciit@gmail.com

________________________________________________________________________________

Q.1: Identify the valid and invalid Statements for the given code, also write the values for valid
statement.

Int a,b,c;

a=6,

b=7

c=8;

a) abc; b) ++a; c) a++ d) b+=a; e) b+=a*c; f) a++b;

g) a+=6; b=6/6; h) ++b++; i) b=a++ +b++;

Q.2: Write the C++ program for the following output.

Q.3: Find the errors in the following statement if there are and correct them.

a) const int n; b) define char ch ‘B’ c) char c=”ABC”;

d) #define msg “Hello Students”; e) float a b c; f) const double=100;

g) char n[]=”Hello Teachers”; h) int=35; i) long crowed=15000;

j) float average=90.15.

Q.4: Find out the valid and invalid for a variable name if invalid give the reasons.
a) income b) total marks c) double d) average-score

e) room# f) _area g) no_of_students h) long

i) 2ndTry j) $cost

Q.5: For the following describes questions, assume the following declarations.

Int i=1;

Int j=2;

Int k=3;

double x=1.0;

double y=2.0;

double z=3.0;

Rewrite this expression in parenthesis and write its value:

I. i+j==k;
II. k-i<y>x;
III. z-x+1 !=j+k-2*I;

You might also like