

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
this is exam for Programming Fundamentals for Engineers in c languge
Typology: Slides
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Student Name:______________________ SID:___________________ time:40 minutes QUESTION 1 A C program contains the following declarations and initial assignments: int i=15, j=8, k=2; float x= 0.5 , y= -1.0, z; char c=โsโ, s=โxโ; /* character โsโ is 115, and โxโ is 120 */ Use the variables initially assigned to the variables for each expression to determine the value of each the following expressions: (8i-2j+21)%(2s-c) +j - ++y/-k; c = = s; ('x'-'s')/(j=x=5) ij> โxโ && โsโ= = What will be output of the following printf statements for i = 91, x = 987.4321, id=
1. printf("|%-4d|%3.3d|%2d |",x, x, x); 2. printf("|%.0f|%-8.3f|%6.1f |",y, y, y); 3. printf(" "student:Nadi Lutfi" \n " \t :ID%d" \n ",id); QUESTION 2
"student:Nadi Lutfi" " :ID204001"
Compiler error, no โyโ variable
What will the value of i and j be after it is executed j=5; for (i=0; i<5;i++) { j++; ++i; } a) i= 11 j=5 b) i=6 j=5 c) i=5 j=8 d) i=5 j=6 e) i=6 j= What is the value of i and j after the code bellow is executed? int j=3, i=1; if(j= =1) j++; i++; ++j; printf("%d %d", j,i); a) 3 2 b) 5 2 c) 4 2 d) 3 1 e) 4 1 QUESTION 3 Answer if the following statements are True (T) or False (F)
1. #define CM PER INCH 2. 2. #define PI 3. #include <stdio.h> 3. for( ; ; ); 4. switch (num) { case 1; printf (โnum is 1โ); case 2; printf (โnum is 2โ); default; printf (โnum is neither 1 nor 2โ); }