Sie sind auf Seite 1von 2

NFC Institute of Engineering and Fertilizer Research, Faisalabad

Department of Electrical Engineering

Course Name: Introduction to Computing


Examination Course Session Semester Total Maximum
code Marks time

Q# Statement CL PLO Bloom Marks KPI


O Taxonomy
Q1 1 3 C4 5 50%
Identify and correct the errors in each of the following statements;
1. if ( c => 7 ) {
print (“C is greater than or equal to 7\n”);
}
2. Scanf (“%d” . aninteger);
3. Int x = 1.total;
While (x <= 10){
total +=x;
++x;
4. The following code should output the odd integers from 999 to 1:
for (x=999); x >= 1: x += 2) {
printf(“ %d\n” .x);
}
5. What’s wrong with the following while repetition statement (assume z has value 100).
Which is supposed to calculate the sum of this integers from 100 down to 1?
while ( z >=0 )
sum += z;
}
Q2. 2 5 C4 5 50%
Write output of the following program:
a) X =1;
while (x <= 20){
printf (“%d” , x);
if (x %5 == 0);{
puts (“”);
}
else{
printf (“%s”, “%t”);
}
++x;
}
b) main()
{
Int a = 40;
If ( a > 40 && a < 45)
Printl (“a is greater than 40 and less than 45”)
else
printf (“%d” , a);
}
c) main()
{
Int j;
While (j <= 10)
{
Printf (“\n%d” , j);
J = I +1 ;
}
Q3. 3 7 C4 20 50%
a) write a program that inputs three-digit number and then reverse the digit of number
using loop?

b) In a company, worker efficiency id determined on the basis of the time required for a
worker to complete a particular job. If the time taken by the worker I between 2 -3
hours, then the worker is said to be highly efficient. If the time required by worker
between 3 – 4 hours, then the worker is ordered to improve speed. If the time taken is
between 4 – 5 hours, the worker is given training to improve his speed, and if the time
taken by the worker is more than 5 hours, then the worker has to leave the company. If
the time taken by the worker is input through the keyboard, find the efficiency of the
worker.

Das könnte Ihnen auch gefallen