C Programming Skills Test! Trivia Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Pranay573
P
Pranay573
Community Contributor
Quizzes Created: 5 | Total Attempts: 15,856
Questions: 40 | Attempts: 106

SettingsSettingsSettings
C Programming Skills Test! Trivia Quiz - Quiz

.


Questions and Answers
  • 1. 

    Can we write a function that takes a variable argument list and passes the list to another function?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Yes, we can write a function that takes a variable argument list, also known as a variadic function, and passes the list to another function. This can be achieved by using the ellipsis (...) syntax in the function declaration to indicate that the function can accept a variable number of arguments. The variadic function can then pass these arguments to another function using the same ellipsis syntax. This allows for flexibility and the ability to handle different numbers of arguments in a single function.

    Rate this question:

  • 2. 

    What will be the output of the program in Turbo C? #include int main() { char str[10] = "Choice"; str[6] = "User"; printf("%s\n", str); return 0; }

    • A.

      Choice User

    • B.

      Choice

    • C.

      User

    • D.

      Error

    Correct Answer
    D. Error
    Explanation
    str[6] = "User"; - Nonportable pointer conversion.

    Rate this question:

  • 3. 

    What will be the output of the program ? #include int main() { int i; char a[] = "\0"; if(printf("%s", a)) printf("The string is empty\n"); else printf("The string is not empty\n"); return 0; }

    • A.

      The string is empty

    • B.

      The string is not empty

    • C.

      No output

    • D.

      0

    Correct Answer
    B. The string is not empty
    Explanation
    The function printf() returns the number of charecters printed on the console.

    Step 1: char a[] = "\0"; The variable a is declared as an array of characters and it initialized with "\0". It denotes that the string is empty.

    Step 2: if(printf("%s", a)) The printf() statement does not print anything, so it returns '0'(zero). Hence the if condition is failed.

    In the else part it prints "The string is not empty".

    Rate this question:

  • 4. 

    If the size of pointer is 32 bits What will be the output of the program ? #include int main() { char a[] = "Visual C++"; char *b = "Visual C++"; printf("%d, %d\n", sizeof(a), sizeof(b)); printf("%d, %d", sizeof(*a), sizeof(*b)); return 0; }

    • A.

      10, 2 2, 2

    • B.

      10, 4 1, 2

    • C.

      11, 4 1, 1

    • D.

      12, 2 2, 2

    Correct Answer
    C. 11, 4 1, 1
    Explanation
    The program declares a character array "a" and a character pointer "b". The size of "a" is 11 bytes because it includes the null character at the end of the string "Visual C++". The size of "b" is 4 bytes because it is a pointer and the size of a pointer is determined by the architecture of the system, which in this case is 32 bits. The size of "*a" is 1 byte because it is dereferencing the first character of the array "a". The size of "*b" is also 1 byte because it is dereferencing the first character of the string "Visual C++".

    Rate this question:

  • 5. 

    What will be the output of the program? #include #include int main() { char dest[] = {97, 97, 0}; char src[] = "aaa"; int i; if((i = memcmp(dest, src, 2))==0) printf("Got it"); else printf("Missed"); return 0; }

    • A.

      Missed

    • B.

      Got it

    • C.

      Error in memcmp statement

    • D.

      None of the above

    Correct Answer
    B. Got it
    Explanation
    memcmp compares the first 2 bytes of the blocks dest and src as unsigned chars. So, the ASCII value of 97 is 'a'. if((i = memcmp(dest, src, 2))==0) When comparing the array dest and src as unsigned chars, the first 2 bytes are same in both variables.so memcmp returns '0'. Then, the if(0=0) condition is satisfied. Hence the output is "Got it".

    Rate this question:

  • 6. 

    What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample Jan Feb Mar /* sample.c */ #include #include int main(int arc, char *arv[]) { int i; for(i=1; i<_argc; i++) printf("%s ", _argv[i]); return 0;

    • A.

      No output

    • B.

      Sample Jan Feb Mar

    • C.

      Jan Feb Mar

    • D.

      Error

    Correct Answer
    C. Jan Feb Mar
    Explanation
    The program will output "Jan Feb Mar" because it takes the command line arguments passed to it (in this case, "Jan", "Feb", and "Mar") and prints them out using a for loop.

    Rate this question:

  • 7. 

    What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample one two three /* sample.c */ #include int main(int argc, char *argv[]) { int i=0; i+=strlen(argv[1]); while(i>0) { printf("%c", argv[1][--i]); } return 0; }

    • A.

      Three two one

    • B.

      Owt

    • C.

      Eno

    • D.

      Eerht

    Correct Answer
    C. Eno
    Explanation
    The program takes command line arguments and stores them in the "argv" array. It then calculates the length of the first argument using "strlen" function and stores it in the variable "i". The program then enters a while loop and prints each character of the first argument in reverse order by accessing the "argv[1]" array using the index "i". Since the first argument is "one", the output will be "eno" as it is printed in reverse order.

    Rate this question:

  • 8. 

    What will be the output of the program #include void fun(int); int main(int argc) { printf("%d\n", argc); fun(argc); return 0; } void fun(int i) { if(i!=4) main(++i); }

    • A.

      123

    • B.

      1234

    • C.

      234

    • D.

      1

    Correct Answer
    B. 1234
    Explanation
    The program starts by printing the value of argc, which is the number of command line arguments passed to the program. In this case, argc is 123. Then, the fun() function is called with the value of argc. Inside the fun() function, it checks if the value of i is not equal to 4. Since i is 123, it is not equal to 4, so it calls the main() function again with i incremented by 1. This process continues until i becomes 4. So, the program will print 1234 as the output.

    Rate this question:

  • 9. 

    What is the output of the program #include int main() { int x = 10, y = 20, z = 5, i; i = x < y < z; printf("%d\n", i); return 0; }

    • A.

      0

    • B.

      1

    • C.

      Error

    • D.

      None

    Correct Answer
    B. 1
    Explanation
    Since x < y turns to be TRUE it is replaced by 1. Then 1 < z is compared and to be TRUE. The 1 is assigned to i.

    Rate this question:

  • 10. 

    What is the output of the program given below ? #include int main() { enum status { pass, fail, atkt}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = atkt; stud3 = fail; printf("%d, %d, %d\n", stud1, stud2, stud3); return 0; }

    • A.

      0, 1, 2

    • B.

      0,2,1

    • C.

      1, 2, 3

    • D.

      1,3,2

    Correct Answer
    B. 0,2,1
    Explanation
    enum takes the format like {0,1,2..) so pass=0, fail=1, atkt=2

    stud1 = pass (value is 0)

    stud2 = atkt (value is 2)

    stud3 = fail (value is 1)

    Hence it prints 0, 2, 1

    Rate this question:

  • 11. 

    Which files will get closed through the fclose() in the following program? #include int main() { FILE *fs, *ft, *fp; fp = fopen("A.C", "r"); fs = fopen("B.C", "r"); ft = fopen("C.C", "r"); fclose(fp, fs, ft); return 0; }

    • A.

      "A.C" "B.C" "C.C"

    • B.

      "B.C" "C.C"

    • C.

      "A.C"

    • D.

      Error in fclose()

    Correct Answer
    D. Error in fclose()
    Explanation
    Extra parameter in call to fclose().

    Rate this question:

  • 12. 

          Assunming, integer is 2 byte, What will be the output of the program? #include int main() { printf("%x\n", -2<<2); return 0; }

    • A.

      Ffff

    • B.

      0

    • C.

      Fff8

    • D.

      Error

    Correct Answer
    C. Fff8
    Explanation
    The program is using the left shift operator (

    Rate this question:

  • 13. 

    What will be the output of the program? #include int main() { int fun(int); int i = fun(10); printf("%d\n", --i); return 0; } int fun(int i) { return (i++); }

    • A.

      9

    • B.

      10

    • C.

      11

    • D.

      8

    Correct Answer
    A. 9
    Explanation
    The program calls the function `fun(10)` which returns the value 10 and increments the value of `i` by 1. Then, the program prints `--i`, which decrements the value of `i` by 1 before printing it. Therefore, the output will be 9.

    Rate this question:

  • 14. 

    What will be the output of the program in 16 bit platform (Turbo C under DOS) ? #include int main() { struct value { int bit1:1; int bit3:4; int bit4:4; }bit; printf("%d\n", sizeof(bit)); return 0; }

    • A.

      1

    • B.

      2

    • C.

      4

    • D.

      9

    Correct Answer
    B. 2
    Explanation
    The output of the program will be 2. This is because the struct "value" contains three bit fields: bit1 with 1 bit, bit3 with 4 bits, and bit4 with 4 bits. The sizeof operator returns the total size in bytes of the struct, which in this case will be 2 bytes.

    Rate this question:

  • 15. 

    What will be the output of the program? #include int addmult(int ii, int jj) { int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } int main() { int i=3, j=4, k, l; k = addmult(i, j); l = addmult(i, j); printf("%d %d\n", k, l); return 0; }

    • A.

      12,12

    • B.

      No error,no output

    • C.

      Error: Compile error

    • D.

      None

    Correct Answer
    A. 12,12
    Explanation
    The program defines a function called addmult that takes in two integers and returns their sum and product. In the main function, the variables i and j are assigned the values 3 and 4 respectively. The addmult function is then called twice, with the result stored in variables k and l. Finally, the values of k and l are printed. Since the addmult function returns the sum and product of the input numbers, the output will be 12 for both k and l.

    Rate this question:

  • 16. 

    In the following program where is the variable a getting defined and where it is getting declared? #include int main() { extern int a; printf("%d\n", a); return 0; } int a=20;

    • A.

      Extern int a is declaration, int a = 20 is the definition

    • B.

      Int a = 20 is declaration, extern int a is the definition

    • C.

      Int a = 20 is definition, a is not defined

    • D.

      A is declared, a is not defined

    Correct Answer
    A. Extern int a is declaration, int a = 20 is the definition
    Explanation
    The statement "extern int a" is a declaration because it is specifying the type and name of the variable without allocating memory for it. The statement "int a = 20" is a definition because it is both declaring the variable and assigning it a value.

    Rate this question:

  • 17. 

    What are the types of linkages?

    • A.

      Internal and External

    • B.

      External, Internal and None

    • C.

      External and None

    • D.

      None

    Correct Answer
    B. External, Internal and None
    Explanation
    The correct answer is "External, Internal and None". This answer suggests that there are three types of linkages: external linkages, internal linkages, and no linkages. External linkages refer to the connections between a program and other programs or libraries outside of its own code. Internal linkages refer to the connections between different parts of a program within its own code. The option "None" suggests that there may be cases where there are no linkages present.

    Rate this question:

  • 18. 

    Which of the following statements are correct about the program? #include int main() { printf("%p\n", main()); return 0; }

    • A.

      It prints garbage values infinitely

    • B.

      Runs infinitely without printing anything

    • C.

      Error: main() cannot be called inside printf()

    • D.

      No Error and print nothing

    Correct Answer
    B. Runs infinitely without printing anything
    Explanation
    The program runs infinitely without printing anything because the printf statement inside the main function is calling the main function recursively. This creates an infinite loop where the program keeps calling itself without any exit condition. As a result, the program does not reach the return statement and does not print anything.

    Rate this question:

  • 19. 

    We want to round off x, a float, to an int value, The correct way to do is

    • A.

      y = (int)(x + 0.5)

    • B.

      Y = int(x + 0.5)

    • C.

      y = (int)x + 0.5

    • D.

      Y = (int)((int)x + 0.5)

    Correct Answer
    A. y = (int)(x + 0.5)
    Explanation
    To round off a float value to the nearest integer, adding 0.5 to the float value and then casting it to an int will give the correct result. This is because adding 0.5 will ensure that the float value is rounded up if the decimal part is greater than or equal to 0.5, and casting it to an int will truncate the decimal part and give the rounded integer value. Therefore, the correct way to round off x to an int value is y = (int)(x + 0.5).

    Rate this question:

  • 20. 

    Which of the following statements are correct about the below C-program? #include int main() { int x = 10, y = 100%90, i; for(i=1; i<10; i++) if(x != y); printf("x = %d y = %d\n", x, y); return 0; } 1 : The printf() function is called 10 times. 2 : The program will produce the output x = 10 y = 10 3 : The ; after the if(x!=y) will NOT produce an error. 4 : The program will not produce output.

    • A.

      1

    • B.

      2,3

    • C.

      3,4

    • D.

      4

    Correct Answer
    B. 2,3
    Explanation
    The program will produce the output x = 10 y = 10 because the if statement is followed by a semicolon, which means that the printf() function will always be executed regardless of the condition. The semicolon after the if(x!=y) will not produce an error because it is a valid syntax in C.

    Rate this question:

  • 21. 

    What will be the output of the program? #include int main() { int k, num=30; k = (num>5 ? (num <=10 ? 100 : 200): 500); printf("%d\n", num); return 0; }

    • A.

      200

    • B.

      30

    • C.

      100

    • D.

      400

    Correct Answer
    B. 30
    Explanation
    The program will output 30. The expression (num>5 ? (num

    Rate this question:

  • 22. 

    Point out the error in the following program. #include int main() { struct emp { char name[20]; float sal; }; struct emp e[10]; int i; for(i=0; i<=9; i++) scanf("%s %f", e[i].name, &e[i].sal); return 0; }

    • A.

      Suspicious pointer conversion

    • B.

      Floating point formats not linked (Run time error)

    • C.

      Cannot use scanf() for structures

    • D.

      Strings cannot be nested inside structures

    Correct Answer
    B. Floating point formats not linked (Run time error)
    Explanation
    The error in the program is that the floating point formats are not properly linked, which can result in a runtime error. This means that the format specifier "%f" used in the scanf() function does not match the data type of the variable e[i].sal, which is a float. This can cause unexpected behavior or crashes during the execution of the program.

    Rate this question:

  • 23. 

    The keyword used to transfer control from a function back to the calling function is

    • A.

      Switch

    • B.

      Goto

    • C.

      Go back

    • D.

      Return

    Correct Answer
    D. Return
    Explanation
    The keyword "return" is used to transfer control from a function back to the calling function. When a function is called, it performs a set of operations and can return a value or nothing back to the calling function using the "return" keyword. This allows the calling function to continue executing from where it left off before the function call. The "return" keyword is essential for controlling the flow of execution in a program and for passing values between functions.

    Rate this question:

  • 24. 

    Which of the following statements are correct about the function? long fun(int num) { int i; long f=1; for(i=1; i<=num; i++) f = f * i; return f; }

    • A.

      The function calculates the value of 1 raised to power num.

    • B.

      The function calculates the square root of an integer

    • C.

      The function calculates the factorial value of an integer

    • D.

      None of above

    Correct Answer
    C. The function calculates the factorial value of an integer
    Explanation
    The given function calculates the factorial value of an integer. It uses a for loop to multiply the variable 'f' with each number from 1 to 'num'. The final value of 'f' is then returned as the factorial value of the input number.

    Rate this question:

  • 25. 

    Which of the statements is correct about the program? #include int main() { float a=3.14; char *j; j = (char*)&a; printf("%d\n", *j); return 0; }

    • A.

      It prints ASCII value of the binary number present in the first byte of a float variable a.

    • B.

      It prints character equivalent of the binary number present in the first byte of a float variable a.

    • C.

      It will print 3

    • D.

      It will print a garbage value

    Correct Answer
    A. It prints ASCII value of the binary number present in the first byte of a float variable a.
    Explanation
    The program is declaring a float variable "a" and initializing it with the value 3.14. It then declares a character pointer "j" and assigns the address of "a" to it. By typecasting "j" to a char pointer, it treats the memory location of "a" as a character. When the program prints "*j", it is printing the ASCII value of the binary number present in the first byte of the float variable "a".

    Rate this question:

  • 26. 

    Which of the following statements are correct about an array? 1: The array int num[26]; can store 26 elements. 2: The expression num[1] designates the very first element in the array. 3: It is necessary to initialize the array at the time of declaration. 4: The declaration num[SIZE] is allowed if SIZE is a macro.

    • A.

      1

    • B.

      1,4

    • C.

      3,4

    • D.

      1,4,2

    Correct Answer
    B. 1,4
    Explanation
    The given correct answer is 1 and 4.



    1: The array int num[26]; can store 26 elements. This statement is correct as the size of the array is specified as 26, indicating that it can store 26 elements.

    4: The declaration num[SIZE] is allowed if SIZE is a macro. This statement is also correct as if SIZE is defined as a macro, it can be used to specify the size of the array during declaration.

    Rate this question:

  • 27. 

    Will the program compile in Turbo C? #include int main() { int a=10, *j; void *k; j=k=&a; j++; k++; printf("%u %u\n", j, k); return 0; }

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The program will not compile in Turbo C because Turbo C does not support the use of void pointers in this manner. Void pointers cannot be incremented or decremented in Turbo C, so the statements "j++" and "k++" will cause a compilation error.

    Rate this question:

  • 28. 

    If char=1, int=4, and float=4 bytes size, What will be the output of the program ? #include int main() { char ch = 'A'; printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f)); return 0; }

    • A.

      1, 2, 4

    • B.

      1,4,4

    • C.

      2,2,4

    • D.

      2, 4, 8

    Correct Answer
    B. 1,4,4
    Explanation
    The output of the program will be "1, 4, 4". The first sizeof(ch) will return 1 because the size of a char variable is 1 byte. The second sizeof('A') will return 4 because 'A' is treated as an integer constant and its size is 4 bytes. The third sizeof(3.14f) will return 4 because it is a float constant and its size is also 4 bytes.

    Rate this question:

  • 29. 

    The library function used to find the last occurrence of a character in a string is

    • A.

      Strnstr()

    • B.

      Laststr()

    • C.

      Strrchr()

    • D.

      Strstr()

    Correct Answer
    C. Strrchr()
    Explanation
    The strrchr() function is the correct library function used to find the last occurrence of a character in a string. It searches for the last occurrence of a specified character in a string and returns a pointer to that character or NULL if the character is not found.

    Rate this question:

  • 30. 

    What will be the output of the program ? #include int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; }

    • A.

      What will be the output of the program ? #include int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; } What will be the output of the program ? #include int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; } Kagpur, Kanpur

    • B.

      Nagpur, Kanpur

    • C.

      Kagpur, anpur

    • D.

      Error

    Correct Answer
    D. Error
    Explanation
    The program will result in an error because the line "str = "Kanpur";" is trying to assign a new value to the array variable "str", which is not allowed in C. Arrays cannot be assigned new values after initialization.

    Rate this question:

  • 31. 

    What will be the output of the program ? #include int main() { int i=4, j=8; printf("%d, %d, %d\n", i|j&j|i, i|j&j|i, i^j); return 0; }

    • A.

      12, 12, 12

    • B.

      112, 1, 12

    • C.

      32, 1, 12

    • D.

      -64, 1, 12

    Correct Answer
    A. 12, 12, 12
    Explanation
    The program uses the bitwise OR (|), bitwise AND (&), and bitwise XOR (^) operators to perform operations on the variables i and j.

    In the first printf statement, i|j&j|i is evaluated. The bitwise AND operator has higher precedence than the bitwise OR operator, so j&j is evaluated first, resulting in 8. Then, i|8 is evaluated, resulting in 12. Therefore, the first value printed is 12.

    In the second printf statement, i|j&j|i is evaluated again. Since the expression has already been evaluated, the same value, 12, is printed again.

    In the third printf statement, i^j is evaluated using the bitwise XOR operator, resulting in 12. Therefore, the third value printed is also 12.

    Therefore, the output of the program is 12, 12, 12.

    Rate this question:

  • 32. 

    Which of the following statement is correct about the program? #include int main() { FILE *fp; char ch; int i=1; fp = fopen("myfile.c", "r"); while((ch=getc(fp))!=EOF) { if(ch == '\n') i++; } fclose(fp); return 0; }

    • A.

      The code counts number of characters in the file

    • B.

      The code counts number of words in the file

    • C.

      The code counts number of blank lines in the file

    • D.

      The code counts number of lines in the file

    Correct Answer
    D. The code counts number of lines in the file
    Explanation
    The given code opens a file named "myfile.c" in read mode and then reads each character from the file until the end of the file (EOF) is reached. Inside the while loop, it checks if the character is a line break ("") and increments the value of the variable "i" if it is. Finally, the code closes the file and returns 0. Therefore, the code counts the number of lines in the file.

    Rate this question:

  • 33. 

    Bit fields CANNOT be used in union.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Bit fields can be used in unions. Unions in C allow multiple members to share the same memory space, and bit fields can be used as members within a union. This allows for efficient memory usage when storing and accessing data that requires a specific number of bits. Therefore, the statement "Bit fields CANNOT be used in union" is incorrect.

    Rate this question:

  • 34. 

    What will be the output of the program? #include int main() { char c=48; int i, mask=01; for(i=1; i<=5; i++) { printf("%c", c|mask); mask = mask<<1; } return 0; }

    • A.

      12400

    • B.

      12480

    • C.

      13400

    • D.

      13480

    Correct Answer
    B. 12480
    Explanation
    The program initializes the variable c with the ASCII value of the character '0' (48). It also initializes the variable mask with the binary value 01. Then, in the for loop, it prints the character equivalent of the bitwise OR operation between c and mask. In each iteration, the value of mask is left shifted by 1.

    In the first iteration, the bitwise OR of '0' (48) and '01' is '1' (49).
    In the second iteration, the bitwise OR of '0' (48) and '10' is '2' (50).
    In the third iteration, the bitwise OR of '0' (48) and '100' is '4' (52).
    In the fourth iteration, the bitwise OR of '0' (48) and '1000' is '8' (56).
    In the fifth iteration, the bitwise OR of '0' (48) and '10000' is '16' (64).

    Therefore, the output of the program is 12480.

    Rate this question:

  • 35. 

    The first argument to be supplied at command-line must always be count of total arguments.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given statement is false. The first argument to be supplied at the command-line does not always have to be the count of total arguments. The first argument can be any value or variable that the program requires, depending on its design and functionality. The count of total arguments can be obtained using the appropriate function or method within the programming language.

    Rate this question:

  • 36. 

    What is the output of the program? typedef struct data; { int x; sdata *b; }sdata;

    • A.

      Error: Declaration missing ';'

    • B.

      Error: in typedef

    • C.

      No error

    • D.

      None

    Correct Answer
    A. Error: Declaration missing ';'
    Explanation
    The program will output "Error: Declaration missing ';'". This error occurs because the semicolon is missing after the typedef declaration of the struct data.

    Rate this question:

  • 37. 

    Which header file should you include, if you are going to develop a function, which can accept variable number of arguments?

    • A.

      Varagrg.h

    • B.

      stdlib.h

    • C.

      Stdio.h

    • D.

      Stdarg.h

    Correct Answer
    D. Stdarg.h
    Explanation
    To develop a function that can accept a variable number of arguments, you need to include the stdarg.h header file. This header file provides the necessary macros and functions for handling variable arguments in C programming.

    Rate this question:

  • 38. 

    Point out the error in the following program. #include #include 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); }

    • A.

      Error: too many parameters

    • B.

      Error: invalid access to list member

    • C.

      Error: ptr must be type of va_list

    • D.

      No error

    Correct Answer
    C. Error: ptr must be type of va_list
    Explanation
    The error in the program is that the variable "ptr" in the varfun() function should be of type "va_list" instead of "float *". The va_start() function requires the first argument to be of type "va_list", which is used to access the variable arguments passed to the function.

    Rate this question:

  • 39. 

    Is standard library a part of C language?

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The C standard library consists of a set of sections of the ISO C standard which describe a collection of header files and library routines used to implement common operations, such as input/output and string handling, in the C programming language. The C standard library is an interface standard described by a document; it is not an actual library of software routines available for linkage to C programs.

    Rate this question:

  • 40. 

    va_list is an array that holds information needed by va_arg and va_end

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    The statement is true because va_list is a data type that is used to hold information about the variable arguments in a function. It is an array-like structure that stores the necessary information for the va_arg and va_end macros to access the variable arguments. These macros are used in variable argument functions to retrieve the values of the arguments. Therefore, va_list does indeed hold the information needed by va_arg and va_end.

    Rate this question:

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.