Infinity 2k18 - Code Quest

30 Questions

Settings
Please wait...
Infinity 2k18 - Code Quest

For all the avid coders out there. . Here's an amazing opportunity to augment your technical skills. . . Pitch in to an advent of coding canons #CODEQUEST is a simple event of three stages in it. . .


Questions and Answers
  • 1. 
    What will happen if the below program is executed? #include  int main()  int main =3;  printf("%d", main);  return 0;  }
    • A. 

      It will cause a compile-time error

    • B. 

      It will cause a run-time error

    • C. 

      It will run without any error and prints 3

    • D. 

      It will experience infinite looping

  • 2. 
    Which of the following cannot be a variable name in c?
    • A. 

      Volatile

    • B. 

      True

    • C. 

      Friend

    • D. 

      Export

  • 3. 
    The maximum number of arguments that can be passed in a single function are_________________
    • A. 

      127

    • B. 

      253

    • C. 

      361

    • D. 

      No limits in number of arguments

  • 4. 
    User-defined data type can be derived by_____________
    • A. 

      Struct

    • B. 

      Enum

    • C. 

      Typedef

    • D. 

      All of the mentioned

  • 5. 
    Size of a union is determined by size of the.
    • A. 

      First member in the union

    • B. 

      Last member in the union

    • C. 

      Biggest member in the union

    • D. 

      Sum of the sizes of all members

  • 6. 
    Members of a union are accessed as________________
    • A. 

      Union-name.member

    • B. 

      Union-pointer->member

    • C. 

      Both union-name.member& union-pointer->member

    • D. 

      None of the above mentioned

  • 7. 
    What type of array is generally generated in command-line argument?
    • A. 

      Single dimension array

    • B. 

      2-dimensional square array

    • C. 

      Jagged array

    • D. 

      2-dimensional rectangular array

  • 8. 
    Operation “a = a * b + a” can also be written as :
    • A. 

      A *= b + 1;

    • B. 

      (c = a * b)!=(a = c + a);

    • C. 

      A = (b + 1)* a;

    • D. 

      All of the above

  • 9. 
    The following expression can be substituted for.     if (isalpha(c) && isdigit(c))
    • A. 

      If (isalnum(c))

    • B. 

      If (isalphanum(c))

    • C. 

      If (isalphanumeric(c))

    • D. 

      None of the above

  • 10. 
    C++ exception handling mechanism mainly uses how many keywords?
    • A. 

      Four

    • B. 

      Three

    • C. 

      Two

    • D. 

      None of the above

  • 11. 
    After defining the function template, the next step to call it in another function such as ______________
    • A. 

      Int()

    • B. 

      Secondary()

    • C. 

      Template()

    • D. 

      Main()

  • 12. 
    Runtime polymorphism is achieved by____________
    • A. 

      Friend function

    • B. 

      Virtual function

    • C. 

      Operator overloading

    • D. 

      Function overloading

  • 13. 
    Which of the following is/are the new cast operators used in c++.
    1. const_cast
    2. static_cast
    3. dynamic_cast
    4. new_cast
    • A. 

      1, 2 and 3 only

    • B. 

      2, 3 and 4 only

    • C. 

      1, 3 and 4 only

    • D. 

      All 1, 2, 3 and 4

  • 14. 
    Which of the following statements about member functions are true or false.
    1. A member function can call another member function directly with using the dot operator.
    2. Member function can access  the private data of the class.
    • A. 

      1 - true, 2 - true

    • B. 

      1 - false, 2 - true

    • C. 

      1 - true, 2 - false

    • D. 

      1 - true, 2 - true

  • 15. 
    Static variables are like ___________ as they are declared in a class declaration and defined in the source file.
    • A. 

      Inline member function

    • B. 

      Non-inline member function

    • C. 

      Static member function

    • D. 

      Dynamic member function

  • 16. 
    Which statement gets affected when i++ is changed to ++i?
    • A. 

      I = 20; i++;

    • B. 

      For (i = 0; i

    • C. 

      A = i++;

    • D. 

      While (i++ = 20) cout

  • 17. 
    If a program uses inline function, then the function is expanded inline at ____________
    • A. 

      Compile time

    • B. 

      Run time

    • C. 

      Both A and B

    • D. 

      None of the above

  • 18. 
    If an argument to a function is declared as const, then
    • A. 

      Function can modify the argument

    • B. 

      Function can’t modify the argument

    • C. 

      Const argument to a function is not possible

    • D. 

      None of the above

  • 19. 
    Which cause a compiler error?
    • A. 

      Int[ ] scores = {3, 5, 7};

    • B. 

      Int [ ][ ] scores = {2,7,6}, {9,3,45};

    • C. 

      String cats[ ] = {"fluffy", "spot", "zeus"};

    • D. 

      Boolean results[ ] = new boolean [] {true, false, true};

    • E. 

      Integer results[ ] = {new integer(3), new integer(5), new integer(8)};

  • 20. 
    Which interface provides the capability to store objects using a key-value pair?
    • A. 

      Java.util.map

    • B. 

      Java.util.set

    • C. 

      Java.util.list

    • D. 

      Java.util.collection

  • 21. 
    public class myfile   {     public static void main (string[] args)     {         string biz = args[1];         string baz = args[2];         string rip = args[3];         System.out.println("arg is " + rip);     }   } Select how you would start the program to cause it to print: arg is 2
    • A. 

      Java myfile 222

    • B. 

      Java myfile 1 2 2 3 4

    • C. 

      Java myfile 1 3 2 2

    • D. 

      Java myfile 0 1 2 3

  • 22. 
    What will be the output of the program? public class arraytest   {     public static void main(string[ ] args)     {         float f1[ ], f2[ ];         f1 = new float[10];         f2 = f1;         System.out.println("f2[0] = " + f2[0]);     }   }
    • A. 

      It prints f2[0] = 0.0

    • B. 

      It prints f2[0] = nan

    • C. 

      An error at f2 = f1; causes compile to fail.

    • D. 

      It prints the garbage value.

  • 23. 
    What is the output of the following program? public class Test {     public static void main(String[] args)     {         double data = 444.324;         int sum = 9;         float value = 5.1f;         System.out.println(data + sum + value);               } }
    • A. 

      444.32495.1

    • B. 

      456

    • C. 

      458.42399

    • D. 

      458.4

  • 24. 
    What will be the output of the program? public class test  {     private static int[] x;     public static void main(string[] args)     {         system.out.println(x[0]);     }  }
    • A. 

      0

    • B. 

      Null

    • C. 

      Compile error

    • D. 

      Nullpointerexception at runtime

  • 25. 
    What will be the output :   int i=25;   byte b=(byte)i;   System.out.println(b);
    • A. 

      255

    • B. 

      -1

    • C. 

      -255

    • D. 

      -127

  • 26. 
    What is the time complexity of inserting a node in a doubly linked list?
    • A. 

      O(nlogn)

    • B. 

      O(logn)

    • C. 

      O(n)

    • D. 

      O(1)

  • 27. 
    With what data structure can a priority queue be implemented ?
    • A. 

      Array

    • B. 

      List

    • C. 

      Heap

    • D. 

      All of above

  • 28. 
    What is the maximum possible number of edges in a directed graph with no self loops having 8 vertices?
    • A. 

      28

    • B. 

      64

    • C. 

      256

    • D. 

      56

  • 29. 
    The given array is arr = {2,6,1}. What are the pivots that are returned as a result of subsequent partitioning?
    • A. 

      1 and 6

    • B. 

      6 and 1

    • C. 

      2 and 6

    • D. 

      None of the above mentioned

  • 30. 
    Which of the following application makes use of a circular linked list?
    • A. 

      Undo operation in a text editor

    • B. 

      Recursive function calls

    • C. 

      Allocating CPU to resources

    • D. 

      All of the above mentioned