My Report

C Programming Practice Test 3


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

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

    #include <stdio.h>
    int main()
    {
        register int i = 10;
        int *p = &i;
        *p = 11;
        printf("%d %d\n", i, *p);
    } 

2. If #include is used with file name in angular brackets.

3. What is #include <stdio.h>?

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

    #include <stdio.h>
    void foo();
    int main()
    {
        void foo(int);
        foo(1);
        return 0;
    }
    void foo(int i)
    {
        printf("2 ");
    } 

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

    #include <stdio.h>
    int main()
    {
        int i = 0, j = 0;
        while (l1: i < 2)
        {
            i++;
            while (j < 3)
            {
                printf("loop\n");
                goto l1;
            }
        }
   } 

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

7. Is initialisation mandatory for local static variables?

8. What is the scope of an external variable?

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

    #include <stdio.h>
    int *i;
    int main()
    {
        if (i == NULL)
            printf("true\n");
        return 0;
    } 

10. #include statement must be written __________


 

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.