Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C PROGRAM QUESTIONS : PART 10

The output of the code below is?
    void main()
    {
        int i = 0, k;
        label: printf("%d", i);
       if (i == 0)
            goto label;
   }

 Infinite 0 
Nothing 
Error
SHOW ANSWER

What is the output of this C code?
    void main()
    {
        int i = 5, k;
        if (i == 0)
            goto label;
           label: printf("%d", i);
            printf("Hey");
    }

 Hey 
 5 Hey
Nothing
SHOW ANSWER

goto can be used to jump from main to within a function?

true 
false 
 depends 
Varies
SHOW ANSWER

What is the output of this C code?
    int main()
    {
        printf("%d ", 1);
        goto l1;
      printf("%d ", 2);
        l1:goto l2;
        printf("%d ", 3);
        l2:printf("%d ", 4);
   }

1 4 
Compile time error 
1 2 4 
1 3 4
SHOW ANSWER

What is the output of this C code?
    int main()
   {
        printf("%d ", 1);
        l1:l2:
       printf("%d ", 2);
        printf("%d\n", 3);
    }

Compile time error 
1 2 3 
 1 2 
1 3
SHOW ANSWER

What is the output of this C code?
    int main()
    {
        printf("%d ", 1);
        goto l1;
        printf("%d ", 2);
    }
    void foo()
    {
      l1: printf("3 ", 3);
    }

1 2 3
1 3
1 3 2
Compile time error
SHOW ANSWER

What is the output of this C code?
    int main()
    {
        int i = 0, j = 0;
        while (i < 2)
        {
            l1: i++;
            while (j < 3)
            {
                printf("loop\n");
                goto l1;
            }
        }
   }

loop loop 
Compile time error 
loop loop loop loop 
Infinite loop
SHOW ANSWER

What is the output of this C code?
    int main()
    {
        int i = 0, j = 0;
        while (l1: i < 2)
        {
            i++;
            while (j < 3)
            {
                printf("loop\n");
                goto l1;          
     }
       }
   }

loop loop 
 Compile time error 
 loop loop loop loop 
Infinite loop
SHOW ANSWER

What is the output of this C code?
    int main()
    {
        int i = 0, j = 0;
        l1: while (i < 2)
            {
                i++;
                while (j < 3)
                {
                   printf("loop\n");
                    goto l1;
               }
            }
   }

loop loop 
 Compile time error 
loop loop loop loop 
 Infinite loop
SHOW ANSWER

The output of the code below is?
   void main()
    {
        int x = 5;
        if (x < 1)
            printf("hello");
        if (x == 5)
            printf("hi");
        else
            printf("no");
    }

hi 
 hello 
 no 
None of the mentioned
SHOW ANSWER

The output of the code below is?
    int x;
    void main()
    {
        if (x)
           printf("hi");
        else
          printf("how are u");
   }

hi 
 how are you
Compile time error
None of the mentioned
SHOW ANSWER

Comment on the following code below?
    void main()
    {
       int x = 5;
        if (true);
            printf("hello");
    }

It will display hello 
It will throw an error 
 Nothing will be displayed
 Compiler dependent    
SHOW ANSWER

What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
        void foo();
        printf("1 ");
        foo();
    }
    void foo()
    {
        printf("2 ");
    }

1 2
Compile time error
1 2 1 2
Depends on the compiler
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in