adplus-dvertising

Welcome to the Input and Output in C MCQs Page

Dive deep into the fascinating world of Input and Output in C with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Input and Output in C, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Input and Output in C, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Input and Output in C. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Input and Output in C. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Input and Output in C MCQs | Page 4 of 42

Q31.
Which of the following macro extracts an argument from the variable argument list (i.e ellipsis) and advance the pointer to the next argument?
Discuss
Answer: (b).va_arg
Discuss
Answer: (a).To declare a variable that will refer to each argument in turn;
Discuss
Answer: (c).Returns one argument & Steps va_list variable to the next
Q34.
The standard header _______ is used for variable list arguments (…) in C.
Discuss
Answer: (d).<stdarg.h>
Discuss
Answer: (c).Cleanup is necessary & Must be called before the program returns
Q36.
What is the output of this C code?
#include <stdio.h>
    int f(char chr, ...);
    int main()
    {
        char c = 97;
        f(c);
        return 0;
    }
    int f(char c, ...)
    {
        printf("%c\n", c);
    }
Discuss
Answer: (a).Compile time error
Q37.
What is the output of this C code?
#include <stdio.h>
    #include <stdarg.h>
    int f(...);
    int main()
    {
        char c = 97;
        f(c);
        return 0;
    }
    int f(...)
    {
        va_list li;
        char c = va_arg(li, char);
        printf("%c\n", c);
    }
Discuss
Answer: (a).Compile time error
Q38.
What is the output of this C code?
#include <stdio.h>
    #include <stdarg.h>
    int f(char c, ...);
    int main()
    {
        char c = 97, d = 98;
        f(c, d);
        return 0;
    }
    int f(char c, ...)
    {
        va_list li;
        va_start(li, c);
        char d = va_arg(li, char);
        printf("%c\n", d);
        va_end(li);
    }
Discuss
Answer: (b).Undefined behaviour
Q39.
What is the output of this C code?
#include <stdio.h>
    #include <stdarg.h>
    int f(char c, ...);
    int main()
    {
        char c = 97, d = 98;
        f(c, d);
        return 0;
    }
    int f(char c, ...)
    {
        va_list li;
        va_start(li, c);
        char d = va_arg(li, int);
        printf("%c\n", d);
        va_end(li);
    }
Discuss
Answer: (d).b
Q40.
What is the output of this C code?
#include <stdio.h>
    #include <stdarg.h>
    int f(int c, ...);
    int main()
    {
        int c = 97;
        float d = 98;
        f(c, d);
        return 0;
    }
    int f(int c, ...)
    {
        va_list li;
        va_start(li, c);
        float d = va_arg(li, float);
        printf("%f\n", d);
        va_end(li);
    }
Discuss
Answer: (b).Undefined behaviour
Page 4 of 42

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!