Quiz Easy - 3 - Cipheronics - Codes n' Electronics.

Hot

Post Top Ad

Responsive Ads Here

Tuesday, 8 August 2017

Quiz Easy - 3

17. What is the Output of the below C-Code.?
#include <stdio.h>
int main() 

int i = 0X53F; 
        printf ("%X", i + 1); 

ANS : 540
==============================================================
18. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
int x = 2, y = 0, z;
z = y && (y | 10);
printf("%d", z);
}
ANS : 0
==============================================================
19. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
int x = 0, y;
y = (x++, x);
printf("%d", y);
}
ANS : 1
==============================================================
20. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
int i = 2, j = 3, k, l;
double a, b;
k = i / j * j;
l = j / i * j;
a = i / j * i;
b = j / i * i;
printf("%d\n%d\n", k, l);
printf("%f\n%f\n", a, b);
}
ANS : 0 3 0.00000 2.00000
==============================================================
21. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    printf("before continue ");
    continue;
    printf("after continue\n");
}
ANS : Compiler time error
==============================================================
22. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    int a = 15;
    printf("%d %d %d", a, ++a, a++);
    return 0;
}
ANS : n.o.a
==============================================================
23. What is the Output of the below C-Code.?
int main()
{
int x;
for(x = 1; x <= 5; x++)
{
   switch(x)
   {
      case 1:
         printf("www.");
         continue;
      case 2:
      case 3:
      case 4:
         continue;
      case 5:
         printf("Infibytes");
    }
    printf(".ml");
}
return 0;
}
ANS :  www.Infibytes.ml
==============================================================
24.  What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    int y = 2,  z;
    z = (y + (y = 10));
    printf("%d",  z);
}
ANS : 20
==============================================================
25. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    int x = 2, y = 5;
    if (x == 2 && y++)
    {
        if (y==6 || ++x)
        {
            printf("x=%d, y=%d", x, y);
        }
    }
}
ANS : x=2, y=6
==============================================================
26. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    int a = 0X00000000;
    int b = 0X00000008;
    if ((a & b) || (a = b = 0))
    {
        printf("Hello a=%d b=%d\n", a, b);
    }
    printf("World a=%d b=%d\n", a, b);
}
ANS : World  a=0 b=0
==============================================================
27. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    signed char c = 125;
    c = 125 + 10;
    printf("%d", c);
    return 0;
}
ANS :  -121
==============================================================
28. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    char c = 280;
    switch(c) {

        case 280: printf("280");
            break;

        case 24: printf("24");
            break;

        default: printf("No surprises");
            break;
    }
}
ANS : 24
==============================================================
29. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    unsigned char ch;
    for(ch='0';ch <= 127;ch++)
        printf("%d", ch);
    return 0;
}
ANS : Prints from 48 to 127
==============================================================
30. Which loop will run faster?
// Code A
for(int i=0; i<100; i++)
for(int j=0; j<10; j++)

// Code B
for(int j=0; j<10; j++)
for(int i=0; i<100; i++)
ANS : Code B
==============================================================
31. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    int a = -60, b = -34;
    unsigned int c = -24;
    printf("%d", c);
    return 0;
}
ANS : -24
==============================================================
32. What is the Output of the below C-Code.?
#include <stdio.h>
void main()
{
    int i = 0;
    do
    {
        printf("Hello");
    } while (i != 0);
}
ANS : Hello
==============================================================
33. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    int x=5;
    switch(x*2)
    {
        case 15:
           printf("One");
      break;
      case 10:
    continue;
      printf("Two");
      default:
            printf("Three");
    }
    return 0;
}
ANS : Compiler error can't use continue
==============================================================
34. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    int i = 0;
    do
    {
        i++;
        if (i == 2)
            continue;
            printf("In while loop ");
    } while (i < 2);
    printf("%d\n", i);
}
ANS : In while loop 2
==============================================================
35. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
int x, a = 7, b = 8, c = 2;
x = a > b ? a > c ? a : c : b > c ? b : c;
printf("%d", x);
}
ANS : 8
==============================================================
36. What is the Output of the below C-Code.?
#include <stdio.h>
int main()
{
    unsigned char c = 0xFF;
    int d;
    c >>= 4;
    d = c;
    printf("%d\n", d);
}
ANS : 15
==============================================================

                                                        JUMP TO PAGE : 123,

No comments:

Post a Comment

Post Top Ad

Responsive Ads Here