Structured Programming with C
Programming with C
CSCI 3133
Sample!
PART I. Answer “True” or “False”
1. A Personal Computer is an example of Personal Computing Environment
2 In Time-Sharing Environment many users are connected to one or more computers in shared environment.
3. A Linker translates symbolic languauge into machine language, they soon became Assembly Language.
4. Pseudocode is steps to accomplish the task in graphical symbols .
5. Parallelogram denotes a decision point (if/then/else) in Flowchart diagram. .
6. Boolean can represent only two values, referred to as true and false.
7.
8. C supports logical type through Boolean type or the integer type , any nonzero represent false and zero represent
9. char a, int i, float tax, void x are valid variable declarations.
10. The keyboard is called Standard output file
11. The standard output function is scanf
12.
13.
PART II Trace the following program
38.
And write down their outputs.
1. Which is the error in the given code.
#include
int x;
int main ()
{
x = 7.5 % 3;
return 0;
}
3 . Write the output for the following code
#include
int main (void) /* example of Postfix increment*/
{
int a;
a = 5;
printf("%d", --a );
return 0;
}
4. Write the output for the following code
#include
int main (void)
{
int a;
a = 5;
printf("%d", a++);
return 0;
}
5. . Write the output for the following code
#include
int main (void) /* example of Postfix increment*/
{
int a;
a = 5;
a++;
printf("%d", a);
return 0;
}
6. Write the output for the following code
#include
int main (void)
{
int a = 2;
int b = 3;
int c = 4;
int d= a * b + c;
printf ("%d",d );
return 0;
}
7. Write the output for the following code
#include
int main (void)
{
int a = 2;
int b = 3;
int c = 4;
int d=2;
int e= a * b + c/d;
printf ("%d",e );
return 0;
}
8. Write the output for the following code
#include
int main (void)
{
int a = 2;
int b = 3;
int c = 4;
int d=2;
int e= a * b % c/d;
printf ("%d", e );
return 0;
}
9. Write the output for the following code
#include
int main (void)
{
int a = 2;
int b = 3;
int c = 4;
int d=2;
int e= a +=b *=c -=5;
printf ("%d", e );
return 0;
}
10. Write the output for the following code
#include
int main (void)
{
int a = 9;
int b = 3;
double c;
c=(double)(a/b);
printf ("%0.2f", c );
return 0;
}
11. Write the output for the following code
#include
int main ( )
{
int option_select = 3, int num1=4, num2=2;
switch(option_select)
{
case 1:
printf("%d", num1+num2);
break;
case 2:
printf("%d\n", num1+num2);
case 3:
printf("%d\n", num1-num2);
case 4:
printf("%d\n", num1*num2);
break;
default:
printf("%d\n", num1/num2);
}
12. Write the output for the following code
}
#include
int main ( )
{
int count =1;
while (count < 10)
{
printf("%d ", count);
count += 2;
}
}
Part III
1. Which of the following expression will generate error?
a. x = x +2;
a. x-=x;
a. x+2=x
a. x%=2
2. Which of the following are not postfix operators.
a. x++
b. ++x
c. x*y
d. x--
4. Which of the following are not postfix operators
a. x++
b. ++x
c. x*y
d. x- -
5. Which of the following is not a valid identifier ?
a. _table
b. student-info
c. else
d. 4carInventory
Assume all variables are of type int and each expression is independent of other one. Find the value of y for the following expressions :
a=3, b=5, c=6 , d = -6 , y=0;
25. y= a++ * ++d + ++c; ---------------
26. y= --a/++b + d--/2; ---------------
27. y -= c; --------------
28. y = a +c/a; -----------------
29. y = d – 3 * b +2; ---------
30. y += c ; ------------
Indicate where the error is for the following function definitions.
void fun ( float x, float y)
{
x = 2.0;
y = 3.0
y += x;
return y;
}
Indicate where the error is for the following function definitions.
void (void a, void b)
{
a = b;
return;
}
What value gets printed in the following program?
#include
void printOne (int x);
int main (void)
{
int a;
a = 5;
printOne (a);
printf("%d\n", a);
return 0;
}
void printOne (int x)
{
x =2;
return;
}
What value gets printed in the following program?
#include
int printOne (int x);
int main (void)
{
int a,y;
a = 5;
y=printOne (a);
printf("%d\n", y);
return 0;
}
int printOne (int x)
{
x *=2;
return x;
}
What value gets printed in the following program?
#include
int printOne (int *x);
int main (void)
{
int a,y;
a = 5;
printOne (&a);
printf("%d\n", a);
return 0;
}
int printOne (int *x)
{
*x =*x+2;
return x;
}
What values get printed in the following program?
#include
int main (void)
{
int num = 5;
while (num > 0)
{
printf(" %d", --num);
}
return 0;
}
What values get printed in the following program?
#include
int main (void)
{
int i;
for ( i=5; i > 0; i--)
{
printf(" %d", i);
}
return 0;
}
What values get printed in the following program?
#include
int main (void)
{
int i;
for ( i=0; i ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- adjectives that start with c describe person
- adjectives starting with c to describe people
- words with c in them
- c programming language standard
- c programming language specification
- object oriented programming c pdf
- object oriented programming c book
- c programming int to string
- sql programming with python
- programming with java pdf
- what is fafsa efc with c code
- hands on programming with r pdf