Java

Java

5 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

What would be the output of the following C program?
int n=2, m=3, k;
k = (float)m/(float)n;
printf(k=%0.5d,k);

  1. k=1.00000
  2. k=0.00000
  3. k=00000.1
  4. k=00001
Question 2 Multiple Choice (Single Answer)

What would be the output of the following C code?
int i=1, j=1; int n = 1;
if(n>0){i++;j--;}printf(i=%d, j=%d,i, j);

  1. i=0 j=0
  2. i=2 j=2
  3. i=2 j=0
  4. i =1 j=1
Question 3 Multiple Choice (Single Answer)

Consider the following C statement: int i = 5, n = 2, z;z = (i! =n) || i>n && n;
printf(z = %d,z);
What would be the value of 'z'?

  1. z = 0
  2. z = 1
  3. z = garbage value
  4. Compiler error
Question 4 Multiple Choice (Single Answer)

void main(){int *x, y;y=10;x=&y;
printf(Value of y=%d n, y);
printf(Value of y=%d n, *x);}
What is the output of the above C code?

  1. 10 00
  2. 10 20
  3. 10 10
  4. Compiler Error
Question 5 Multiple Choice (Single Answer)

Consider the following 'C' code and write the output obtained.int a[3][3] = {{1,2,3,4},{5,6,7,8}};
printf(%d,a[0][2]);

  1. 1
  2. 2
  3. 3
  4. 4