1. Question: What is x in the following program?
    #include<stdio.h>
    
    int main()
    {
        typedef char (*(*arrfptr[3])())[10];
        arrfptr x;
        return 0;
    }

    A
    x is a pointer

    B
    x is an array of three pointer

    C
    x is an array of three function pointers

    D
    Error in x declaration

    Note: Not available
    1. Report
  2. Question: What will be the output of the program?
    #include<stdio.h>
    #include<stdarg.h>
    void fun(char *msg, ...);
    
    int main()
    {
        fun("VCampus", 1, 4, 7, 11, 0);
        return 0;
    }
    void fun(char *msg, ...)
    {
        va_list ptr;
        int num;
        va_start(ptr, msg);
        num = va_arg(ptr, int);
        num = va_arg(ptr, int);
        printf("%d", num);
    }

    A
    VCampus 1 7 11 0

    B
    1

    C
    4

    D
    7

    Note: No answer description available for this question.
    1. Report
  3. Question: What will be the output of the program?
    #include<stdio.h>
    #include<stdarg.h>
    void fun1(char, int, int *, float *, char *);
    void fun2(char ch, ...);
    void (*p1)(char, int, int *, float *, char *);
    void (*p2)(char ch, ...);
    
    int main()
    {
        char ch='A'; int i=10;
        float f=3.14; char *p="Hello";
        p1=fun1;
        p2=fun2;
        (*p1)(ch, i, &i, &f, p);
        (*p2)(ch, i, &i, &f, p);
        return 0;
    }
    void fun1(char ch, int i, int *pi, float *pf, char *p)
    {
        printf("%c %d %d %f %s \n", ch, i, *pi, *pf, p);
    }
    void fun2(char ch, ...)
    {
        int i, *pi; float *pf; char *p;
        va_list list;
        printf("%c ", ch);
        va_start(list, ch);
        i = va_arg(list, int);
        printf("%d ", i);
        
        pi = va_arg(list, int*);
        printf("%d ", *pi);
        pf = va_arg(list, float*);
        printf("%f ", *pf);
        p = va_arg(list, char *);
        printf("%s", p);
    }

    A
    A 10 3.14 A 10 3.14

    B
    A 10 10 3.140000 Hello A 10 10 3.140000 Hello

    C
    A 10 Hello A 10 Hello

    D
    Error

    Note: No answer description available for this question.
    1. Report
  4. Question: What will be the output of the program?
    #include<stdio.h>
    #include<stdarg.h>
    void dumplist(int, ...);
    
    int main()
    {
        dumplist(2, 4, 8);
        dumplist(3, 6, 9, 7);
        return 0;
    }
    void dumplist(int n, ...)
    {
        va_list p; int i;
        va_start(p, n);
    
        while(n-->0)
        {
            i = va_arg(p, int);
            printf("%d", i);
        }
        va_end(p);
        printf("\n");
    }

    A
    2 4 3 6

    B
    2 4 8 3, 6, 9, 7

    C
    4 8 6 9 7

    D
    1 1 1 1 1 1 1

    Note: No answer description available for this question
    1. Report
  5. Question: 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);
        }
    }

    A
    A, A B, B C, C D, D

    B
    A, a B, b C, c D, d

    C
    A, 65 B, 66 C, 67 D, 68

    D
    A, 0 B, 0 C, 0 C, 0

    Note: No answer description available for this question.
    1. Report
  6. Question: 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);
    }

    A
    Dogs 12

    B
    Cats 14

    C
    Boys 13

    D
    Apple 12

    Note: No answer description available for this question
    1. Report
  7. Question: Which of the following is the correct order of evaluation for the below expression? z = x + y * z / 4 % 2 - 1

    A
    * / % + - =

    B
    = * / % + -

    C
    / * % - + =

    D
    * % / - + =

    Note: C uses left associativity for evaluating expressions to break a tie between two operators having same precedence.
    1. Report
  8. Question: Which of the following correctly shows the hierarchy of arithmetic operations in C?

    A
    / + * -

    B
    * - / +

    C
    + - / *

    D
    / * + -

    Note: Simply called as BODMAS (Bracket of Division, Multiplication, Addition and Subtraction). How Do I Remember ? BODMAS ! B - Brackets first O - Orders (ie Powers and Square Roots, etc.) DM - Division and Multiplication (left-to-right) AS - Addition and Subtraction (left-to-right)
    1. Report
  9. Question: Which of the following is the correct usage of conditional operators used in C?

    A
    a>b ? c=30 : c=40;

    B
    a>b ? c=30;

    C
    max = a>b ? a>c?a:c:b>c?b:c

    D
    return (a>b)?(a:b)

    Note: Option A: assignment statements are always return in paranthesis in the case of conditional operator. It should be a&gt;b? (c=30):(c=40); Option B: it is syntatically wrong. Option D: syntatically wrong, it should be return (a&gt;b)?(a:b) Option C: it uses nested conditional operator, this is logic for finding greatest number out of three numbers.
    1. Report
  10. Question: Which of the following is the correct order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3();

    A
    f1, f2, f3

    B
    f3, f2, f1

    C
    Order may vary from compiler to compiler

    D
    None of above

    Note: Here, Multiplication will happen before the addition, but in which order the functions would be called is undefined. In an arithmetic expression the parenthesis tell the compiler which operands go with which operators but do not force the compiler to evaluate everything within the parenthesis first.
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd