C Questions

0 votes, 0 avg
697

C Questions

1 / 15

1. What will be the output of the following C code?

        #include 

        int main()

        {

            enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};

            printf("PEACH = %dn", PEACH);

        }

2 / 15

2. Which option should be selected to work the following C expression?

string p = "HELLO";

3 / 15

3. In C, parameters are always 

4 / 15

4. What is the output of C Program.?

int main()
{
    int a=10,b=20;
    
    if(a==9 AND b==20)
    {
        printf("Hurray..");
    }
    
    if(a==10 OR b==21)
    {
        printf("Theatre");
    }

    return 0;
}

5 / 15

5. What will be the output of the following C code if following commands are used to run (considering myfile exists)?

6 / 15

6. The standard header _______ is used for variable list arguments (…) in C.

7 / 15

7. Which of the following is true for the static variable?

8 / 15

8. What is the disadvantage of arrays in C?

9 / 15

9. What will be the output of the following C program?

#include 

int main()
{
    int x[5] = { 10, 20, 30 };
    printf("%ld", sizeof(x)/sizeof(x[0]));
    return 0;
}

10 / 15

10. What will be the output of the following C code?

#include 

int main(){
    char grade = 'B';

    switch (grade) {
    case 'A':
        printf("Excellent!n");
    case 'B':
    case 'C':
        printf("Well donen");
    case 'D':
        printf("You passedn");
    case 'F':
        printf("Better try againn");
        break;
    default:
        printf("Invalid graden");
    }
}

11 / 15

11. What will be the output of the following code snippet?

#include 
void solve() {
    int ch = 2;
    switch(ch) {
        case 1: printf("1 ");
        case 2: printf("2 ");
        case 3: printf("3 ");
        default: printf("None");
    }
}
int main() {
    solve();
return 0;
}

12 / 15

12. Array sizes are optional during array declaration by using ______ keyword.

13 / 15

13. What is output of below program?


int main()
{
 int i,j;
 for(i = 0,j=0;i<5;i++)
 {
   printf("%d%d--",i,j);
 }
 return 0;
}

14 / 15

14. If p is an integer pointer with a value 1000, then what will the value of p + 5 be?

15 / 15

15. What will be the output of the following C code?

        #include 

        int *m();

        void main()

        {

            int *k = m();

            printf("hello ");

            printf("%d", k[0]);

        }

        int *m()

        {

            int a[2] = {5, 8};

            return a;

        }

Your score is

The average score is 39%

0%