My Report

C Programming Mock Test 4


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 sequences are unaccepted in C language?

Question 1 of 10

Question 2 of 10

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

    #include <stdio.h>
    void main()
    {
        #define max 45
        max = 32;
        printf("%d", max);
    } 

Question 2 of 10

Question 3 of 10

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

    #include <stdio.h>
    void main()
    {
        char a[10][5] = {"hi", "hello", "fellows"};
        printf("%p\n", a);
        printf("%p", a[0]);
    } 

Question 3 of 10

Question 4 of 10

4. Which type of variables can have the same name in a different function?

Question 4 of 10

Question 5 of 10

5. Which of the following can never be sent by call-by-value?

Question 5 of 10

Question 6 of 10

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

    #include <stdio.h>
    int main()
    {
        int ary[4] = {1, 2, 3, 4};
        int *p = ary + 3;
        printf("%d %d\n", p[-2], ary[*p]);
    } 

Question 6 of 10

Question 7 of 10

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

    #include <stdio.h>
    void main()
    {
        int k = 5;
        int *p = &k;
        int **m  = &p;
        printf("%d%d%d\n", k, *p, **p);
    }

Question 7 of 10

Question 8 of 10

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

    #include <stdio.h>
    void main()
    {
        char *a[10] = {"hi", "hello", "how"};
        int i = 0;
        for (i = 0;i < 10; i++)
        printf("%s", a[i]);
    } 

Question 8 of 10

Question 9 of 10

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

    #include <stdio.h>
    #define SYSTEM 20
    int main()
    {
        int a = 20;
        #if SYSTEM == a
        printf("HELLO ");
        #endif
        #if SYSTEM == 20
        printf("WORLD\n");
        #endif
    } 

Question 9 of 10

Question 10 of 10

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

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

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.