My Report

C Programming Mock Test 6


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement
 10%

Question 1 of 10

1. Which of the following doesn’t require an & for the input in scanf()?

Question 1 of 10

Question 2 of 10

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

    #include <stdio.h>
    int main()
    {
        short int i;
        scanf("%h*d", &i);
        printf("%hd", i);
        return 0;
    } 

Question 2 of 10

Question 3 of 10

3. What will be the output of the following C statement?

fprintf(stderr, "error: could not open filen");

Question 3 of 10

Question 4 of 10

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

    #include <stdio.h>
    union stu
    {
        int ival;
        float fval;
    };
    void main()
    {
        union stu r;
        r.ival = 5;
        printf("%d", r.ival);
    } 

Question 4 of 10

Question 5 of 10

5. Which member of the union will be active after REF LINE in the following C code?

    #include <stdio.h>
    union temp
    {
        int a;
        float b;
        char c;
    };
    union temp s = {1,2.5,’A’}; //REF LINE

Question 5 of 10

Question 6 of 10

6. What is the default return-type of getchar()?

Question 6 of 10

Question 7 of 10

7. Which of the following is false about typedef?

Question 7 of 10

Question 8 of 10

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

    #include <stdio.h>
    int main()
    {
        char *n;
        scanf("%s", n);
        return 0;
    } 

Question 8 of 10

Question 9 of 10

9. Which of the following may create problem in the typedef program?

Question 9 of 10

Question 10 of 10

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

    #include <stdio.h>
    int main()
    {
        short int i;
        scanf("%hd", &i);
        printf("%hd", i);
        return 0;
    }

Question 10 of 10


 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.