ExamVeda
Login
Home
41
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    printf("%d ", 1);
    l1:l2:
    printf("%d ", 2);
    printf("%d\n", 3);
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
42
What will be the output of the following C code? (Assuming that we have entered the value 2 in the standard input)
#include <stdio.h>
void main()
{
    int ch;
    printf("enter a value between 1 to 2:");
    scanf("%d", &ch);
    switch (ch)
    {
       case 1:
          printf("1\n");
          break;
          printf("Hi");
       default:
          printf("2\n");
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
43
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    printf("%d ", 1);
    goto l1;
    printf("%d ", 2);
}
void foo()
{
    l1 : printf("3 ", 3);
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
44
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int i = 0, j = 0;
    for (i = 0;i < 5; i++)
    {
        for (j = 0;j < 4; j++)
        {
            if (i > 1)
                break;
        }
        printf("Hi \n");
    }
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
45
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)
#include <stdio.h>
void main()
{
    char *ch;
    printf("enter a value between 1 to 3:");
    scanf("%s", ch);
    switch (ch)
    {
       case "1":
          printf("1");
          break;
       case "2":
          printf("2");
          break;
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
46
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int i = 0;
    while (i < 10)
    {
        i++;
        printf("hi\n");
        while (i < 8) 
        {
            i++;
            printf("hello\n");
        }
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
47
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int i = 0;
    while (++i)
    {
        printf("H");
    }
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
48
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    double k = 0;
    for (k = 0.0; k < 3.0; k++);
        printf("%lf", k);
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
49
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)
#include <stdio.h>
void main()
{
    int ch;
    printf("enter a value between 1 to 2:");
    scanf("%d", &ch);
    switch (ch)
    {
       case 1:
          printf("1\n");
       default:
          printf("2\n");
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
50
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int a = 1;
    switch (a)
    {
       case a:
          printf("Case A ");
       default:
          printf("Default");
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board