Вы находитесь на странице: 1из 1

Pgm 5

1.What will be the output of the below code


# include <stdio.h> int main()
{
float f = 0.1; if (f ==0.1)
printf(“YES\n”);
else
printf(“NO\n”);
return 0;
}a.YES b.NO c.Compile time error

3.In the below code, what concept is used


# include <stdio.h>
long int fact (int n); int main ( )
{
int n;
printf ( “ Enter a positive integer:”); scanf (“ %d ”, &n);
printf (“ Factorial of %d = %1d”, n , fact(n)); return 0;
}
long int fact ( int n )
{
if ( n >= 1)
return n * fact ( n – 1); else
return 1;
}a. Iteration b. Segmentation c. Encapsulation d.Recursion

7.Which of the following is the correct order of evaluation for the below expression?
i)z = x + y * z / 4 % 2 – 1 [A].* / % + - = [B].= * / % + - C)/ * % - + = D)* % / - + =

8.# include <stdio.h> int main()


{ short int n, ch;
for (n=7; n!=0; n--)
printf ("%d", n--); ch = getchar();
return 0;}?? a.Endless Loop b.7 6 5 4 3 2 1 c.7 6 5 4 3 2 1 0

10.int x=0, y =0; scanf("%d%c%d",&x,&y); what is the value of x and y if we give 1 2 3?


a.Runtime Error in Unix based Systems and for DOS 1 32 b. 1 3 2 in DOS and runtime error in
unix based systems c. 1 3 2 in both unix and DOS d.Compile time error.

Вам также может понравиться