Hardest C Programming Trivia Quiz! Test

40 Questions | Total Attempts: 178

SettingsSettingsSettings
Hardest C Programming Trivia Quiz! Test - Quiz

.


Questions and Answers
  • 1. 
    When a computer is first turned on or restarted, a special type of absolute loader called ____ is executed
    • A. 

      Compile and Go loader

    • B. 

      Boot loader

    • C. 

      Bootstrap loader

    • D. 

      Relating loader

  • 2. 
    The time factor when determining the efficiency of algorithm is measured by
    • A. 

      Counting microseconds

    • B. 

      Counting the number of key operations

    • C. 

      Counting the number of statements

    • D. 

      Counting the kilobytes of algorithm

  • 3. 
    Which of the following case does not exist in complexity theory
    • A. 

      Best case

    • B. 

      Worst case

    • C. 

      Average case

    • D. 

      Null case

  • 4. 
    The Worst case occur in linear search algorithm when
    • A. 

      Item is somewhere in the middle of the array

    • B. 

      Item is not in the array at all

    • C. 

      Item is the last element in the array

    • D. 

      Item is the last element in the array or is not there at all

  • 5. 
    Linked lists are best suited
    • A. 

      For relatively permanent collections of data

    • B. 

      for the size of the structure and the data in the structure are constantly changing

    • C. 

      For both of above situation

    • D. 

      For none of above situation

  • 6. 
    Multiprogramming systems:
    • A. 

      Are easier to develop than single programming systems

    • B. 

      Execute each job faster

    • C. 

      Execute more jobs in the same time period

    • D. 

      Are used only one large mainframe computers.

  • 7. 
    Given the language L = {ab, aa, baa}, which of the following strings are in L*? (Multiple correct type)  
    • A. 

      Abaabaaabaa

    • B. 

      Aaaabaaaa

    • C. 

      Baaaaabaaaab

    • D. 

      Baaaaabaa

  • 8. 
    Which one of the following is an example of storage class in C?
    • A. 

      Int and float

    • B. 

      Extern

    • C. 

      Both 1 & 2

    • D. 

      Neither 1 nor 2

  • 9. 
    Which one of the following is the correct way of declaring main() function when it receives command line arguments?
    • A. 

      Main(int argc, char argv)

    • B. 

      Main(char argv[ ], int *argc)

    • C. 

      Main(char* argv[ ],int argc)

    • D. 

      Main(int argc,char* argv[ ])

  • 10. 
    Which of the following is a correct way of defining a symbolic constant pie in C
    • A. 

      # define pie = 22/7

    • B. 

      #define pie 22/7

    • C. 

      #define pie= 3.142

    • D. 

      # Define pie 22/7

  • 11. 
    What should be the output of the following C code :  #include <stdio.h> int main() {   static int y;   printf(“%d\n”, y);   return 0;  }
    • A. 

      0

    • B. 

      Run-time error

    • C. 

      Undefined

    • D. 

      Compilation error

  • 12. 
    Consider the following pseudo-code. Assume that IntQueue is a class implementing an integer queue, enqueue() and dequeue() are member functions for inserting and deleting values to/from a queue object respectively.  What does the function fun() do? void fun(int n) {   IntQueue q;   q.enqueue(0);   q.enqueue(1);   for (int i = 0; i < n; i++)   {     int a = q.dequeue();     int b = q.dequeue();     q.enqueue(b);     q.enqueue(a + b);     print(a);   } }
    • A. 

      Prints numbers from 0 to n-1

    • B. 

      Prints numbers from n-1 to 0

    • C. 

      Prints first n Fibonacci numbers

    • D. 

      Prints first n Fibonacci numbers in reverse order.

  • 13. 
    The output of the below C code is : #include <stdio.h> float func(int aa, float bb) {   return ((float)aa + bb); } int main() {   int a;   a = func(10, 3.14);   printf("%d\n", a);   return 0; }
    • A. 

      13.14

    • B. 

      13

    • C. 

      13.00

    • D. 

      None of the above

  • 14. 
    What is the output of the following program? #include<stdio.h> void main() { struct { int x;} var = {5}, *p = &var; printf("%d %d %d", var.x, p->x, (*p).x); }
    • A. 

      5 5 5

    • B. 

      5 5  garbage value

    • C. 

      5 5 0 

    • D. 

      Compile Error

  • 15. 
    What is the output of this C code? #include <stdio.h> void main() {   int y = 97;   int x = y++;   printf("x is %d", x); }  
    • A. 

      X is 97

    • B. 

      X is 98

    • C. 

      X is 99

    • D. 

      Compilation Error

  • 16. 
    What is the output of the below C code? #include <stdio.h> void main() {   char *s = "hello";   char *p = s;   printf("%p %p", p, s); }
    • A. 

      Different addresses are printed

    • B. 

      Same address is printed separated by a space

    • C. 

      Compilation error

    • D. 

      Nothing

  • 17. 
    What is common in three different types of traversals (Inorder, Preorder, and Postorder)?
    • A. 

      Root is visited before right subtree

    • B. 

      Left subtree is always visited before right subtree

    • C. 

      Root is visited after left subtree

    • D. 

      All of the above

  • 18. 
    Find out the correct statement for the following program #include "stdio.h" int * arrPtr[5]; int main() { if(*(arrPtr+2) == *(arrPtr+4)) { printf("Equal!"); } else { printf("Not Equal"); } return 0; }
    • A. 

      Compile Error

    • B. 

      It’ll always print Equal.

    • C. 

      It’ll always print Not Equal.

    • D. 

      Since elements of arrPtr aren’t initialized in the program, it’ll print either Equal or Not Equal.

  • 19. 
    #include <stdio.h> void f(int *p, int *q) {   p = q;   *p = 2; } int i = 0, j = 1; int main() {   f(&i, &j);   printf("%d%d\n", i, j);   return 0; }
    • A. 

      22

    • B. 

      21

    • C. 

      01

    • D. 

      02

  • 20. 
    Is it possible to create a doubly linked list using only one pointer with every node?
    • A. 

      Not Possible

    • B. 

      Yes, possible by storing XOR of addresses of previous and next nodes.

    • C. 

      Yes, possible by storing XNOR of addresses of previous and next nodes.

    • D. 

      Yes, possible by storing XOR of the current node and previous node  

  • 21. 
    The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
    • A. 

      10, 20, 15, 23, 25, 35, 42, 39, 30

    • B. 

      15, 10, 25, 23, 20, 42, 35, 39, 30

    • C. 

      15, 20, 10, 23, 25, 42, 35, 39, 30

    • D. 

      15, 10, 23, 25, 20, 35, 42, 39, 30

  • 22. 
    What is the return type of malloc() or calloc() ?
    • A. 

      Void *

    • B. 

      A pointer of allocated memory type

    • C. 

      Void **

    • D. 

      Int *

  • 23. 
    Predict the output of the below program: #include <stdio.h> #define EVEN 0 #define ODD 1 int main() { int i = 3; switch (i & 1) { case EVEN: printf("Even"); break; case ODD: printf("Odd"); break; default: printf("Default"); } return 0; }
    • A. 

      Even

    • B. 

      Odd

    • C. 

      Default

    • D. 

      Compile-time error

  • 24. 
    Consider the following C declaration struct { short s[5]; union { float y; long z; }u; } t; Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes, and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is
    • A. 

      22 bytes

    • B. 

      14 bytes

    • C. 

      18 bytes

    • D. 

      10 bytes

  • 25. 
    What is the time complexity to search for an element using hashing.
    • A. 

      O(n)

    • B. 

      O(n log(n))

    • C. 

      O(1)

    • D. 

      O(log n)

Back to Top Back to top