adplus-dvertising

Welcome to the Data Types,Operators and Expressions in C MCQs Page

Dive deep into the fascinating world of Data Types,Operators and Expressions in C with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Data Types,Operators and Expressions in C, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Data Types,Operators and Expressions 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 Data Types,Operators and Expressions 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 Data Types,Operators and Expressions in C. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Data Types,Operators and Expressions in C MCQs | Page 39 of 66

Explore more Topics under C Programming

Q381.
What will be the output of the program?
#include<stdio.h>
#include<stdarg.h>
void display(int num, ...);

int main()
{
    display(4, 'A', 'B', 'C', 'D');
    return 0;
}
void display(int num, ...)
{
    char c, c1; int j;
    va_list ptr, ptr1;
    va_start(ptr, num);
    va_start(ptr1, num);
    for(j=1; j<=num; j++)
    {
        c = va_arg(ptr, int);
        printf("%c", c);
        c1 = va_arg(ptr1, int);
        printf("%d\n", c1);
    }
}
Discuss
Answer: (c).A, 65B, 66C, 67D, 68
Q382.
What will be the output of the program?
#include<stdio.h>
#include<stdarg.h>
void fun1(int num, ...);
void fun2(int num, ...);

int main()
{
    fun1(1, "Apple", "Boys", "Cats", "Dogs");
    fun2(2, 12, 13, 14);
    return 0;
}
void fun1(int num, ...)
{
    char *str;
    va_list ptr;
    va_start(ptr, num);
    str = va_arg(ptr, char *);
    printf("%s ", str);
}
void fun2(int num, ...)
{
    va_list ptr;
    va_start(ptr, num);
    num = va_arg(ptr, int);
    printf("%d", num);
}
Discuss
Answer: (d).Apple 12
Q383.
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>
fun(...);

int main()
{
    fun(3, 7, -11.2, 0.66);
    return 0;
}
fun(...)
{
    va_list ptr;
    int num;
    va_start(ptr, n);
    num = va_arg(ptr, int);
    printf("%d", num);
}
Discuss
Answer: (c).Error: Invalid declaration of fun(...)
Q384.
Point out the error if any in the following program (Turbo C).
#include<stdio.h>
#include<stdarg.h>
void display(int num, ...);

int main()
{
    display(4, 'A', 'a', 'b', 'c');
    return 0;
}
void display(int num, ...)
{
    char c; int j;
    va_list ptr;
    va_start(ptr, num);
    for(j=1; j<=num; j++)
    {
        c = va_arg(ptr, char);
        printf("%c", c);
    }
}
Discuss
Answer: (c).No error and print A a b c
Q385.
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>
void varfun(int n, ...);

int main()
{
    varfun(3, 7, -11, 0);
    return 0;
}
void varfun(int n, ...)
{
    va_list ptr;
    int num;
    num = va_arg(ptr, int);
    printf("%d", num);
}
Discuss
Answer: (a).Error: ptr has to be set at begining
Q386.
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>

int main()
{
    void display(char *s, int num1, int num2, ...);
    display("Hello", 4, 2, 12.5, 13.5, 14.5, 44.0);
    return 0;
}
void display(char *s, int num1, int num2, ...)
{
    double c;
    char s;
    va_list ptr;
    va_start(ptr, s);
    c = va_arg(ptr, double);
    printf("%f", c);
}
Discuss
Answer: (c).Error: in va_start(ptr, s);
Q387.
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>

int main()
{
    void display(int num, ...);
    display(4, 12.5, 13.5, 14.5, 44.3);
    return 0;
}
void display(int num, ...)
{
    float c; int j;
    va_list ptr;
    va_start(ptr, num);
    for(j=1; j<=num; j++)
    {
        c = va_arg(ptr, float);
        printf("%f", c);
    }
}
Discuss
Answer: (b).Error: var c data type mismatch
Q388.
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>
void display(char *s, ...);
void show(char *t, ...);

int main()
{
    display("Hello", 4, 12, 13, 14, 44);
    return 0;
}
void display(char *s, ...)
{
    show(s, ...);
}
void show(char *t, ...)
{
    int a;
    va_list ptr;
    va_start(ptr, s);
    a = va_arg(ptr, int);
    printf("%f", a);
}
Discuss
Answer: (b).Error: invalid function show() call
Q389.
Point out the error in the following program.
#include<stdio.h>
#include<stdarg.h>
void varfun(int n, ...);

int main()
{
    varfun(3, 7, -11.2, 0.66);
    return 0;
}
void varfun(int n, ...)
{
    float *ptr;
    int num;
    va_start(ptr, n);
    num = va_arg(ptr, int);
    printf("%d", num);
}
Discuss
Answer: (c).Error: ptr must be type of va_list
Q390.
What are the different types of real data type in C ?
Discuss
Answer: (c).float, double, long double

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!