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. What are the Properties of the first argument of a printf() functions?

Question 1 of 10

Question 2 of 10

2. The syntax to print a % using printf statement can be done by ________

Question 2 of 10

Question 3 of 10

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

    #include <stdio.h>
    int main()
    {
        FILE *fp;
        char c;
        int n = 0;
        fp = fopen("newfile1.txt", "r");
        while (!feof(fp))
        {
            c = getc(fp);
            putc(c, stdout);
        }
    } 

Question 3 of 10

Question 4 of 10

4. Escape sequences are prefixed with ________

Question 4 of 10

Question 5 of 10

5. What is the difference between %e and %g?

Question 5 of 10

Question 6 of 10

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

    #include <stdio.h>
    union
    {
        int x;
        char y;
    }p;
    int main()
    {
        p.y = 60;
        printf("%d\n", sizeof(p));
    } 

Question 6 of 10

Question 7 of 10

7. Members of a union are accessed as________________

Question 7 of 10

Question 8 of 10

8. What type of data is holded by variable u int in the following C code?

    #include <stdio.h>
    union u_tag
    {
        int ival;
        float fval;
        char *sval;
    } u; 

Question 8 of 10

Question 9 of 10

9. Which type of files can’t be opened using fopen()?

Question 9 of 10

Question 10 of 10

10. What will be the output of the following C code (when 4 and 5 are entered)?

    #include <stdio.h>
    void main()
    {
        int m, n;
        printf("enter a number");
        scanf("%d", &n);
        scanf("%d", &m);
        printf("%d\t%d\n", n, m);
    } 

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.