Coder's Challenge Group B (Round 1)

62 Questions | Total Attempts: 44

SettingsSettingsSettings
Coder


Questions and Answers
  • 1. 
    How can we connect to database in a web application?
    • A. 

      Oracle sql developer

    • B. 

      Toad

    • C. 

      Mysql

    • D. 

      JDBC template

  • 2. 
    What is the output of this program?     #include <iostream>     using namespace std;     void fun(int x, int y)     {         x = 20;         y = 10;     }     int main()     {         int x = 10;         fun(x, x);         cout << x;         return 0;     }
    • A. 

      10

    • B. 

      20

    • C. 

      Compile Time Error

    • D. 

      None 

  • 3. 
    What is the output of the following program? public class Test implementsRunnable  {      public void run()      {          System.out.printf("%d",3);      }      public static void main(String[] args) throws Interrupted Exception      {          Thread thread = new Thread(new Test());          thread.start();          System.out.printf("%d",1);          thread.join();          System.out.printf("%d",2);      }     }   
    • A. 

      123

    • B. 

      213

    • C. 

      132

    • D. 

      321

  • 4. 
    . What is the output of the following program? public class Test {     public static void main(String[] args)     {         int value = 3, sum = 6 + -- value         int data = --value + ++value / sum++ * value++ + ++sum  % value--;         System.out.println(data);     } }  
    • A. 

      1

    • B. 

      2

    • C. 

      0

    • D. 

      3

  • 5. 
    What does the following code print? System.out.println("13" + 5 + 3);
    • A. 

      21

    • B. 

      1353

    • C. 

      It will give a run-time error

    • D. 

      138

  • 6. 
    State true or false for Java Program. i) Data members of an interface are by default final ii) An abstract class has implementations of all methods defined inside it.
    • A. 

      I-false, ii-false

    • B. 

      I-false, ii-true

    • C. 

      I-true, ii-false

    • D. 

      I-true, ii-true

  • 7. 
    Which mechanism is used when a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same critical section to be executed? 
    • A. 

      Inter-thread communication

    • B. 

      Initial-thread communication

    • C. 

      Mutual Exclusive

    • D. 

      None of the above

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

      444.324

    • B. 

      444

    • C. 

      Compile time error

    • D. 

      Run time error

  • 9. 
    What does the following line of code achieve? Intent intent = new Intent(FirstActivity.this, SecondActivity.class );
    • A. 

      Creates an hidden Intent  

    • B. 

      Creates an implicit Intent

    • C. 

      Create an explicit Intent

    • D. 

      Starts an activity.

  • 10. 
    Class Base {   public final void show() {        System.out.println("Base::show() called");     } } class Derived extends Base {     public void show() {          System.out.println("Derived::show() called");     } } public class Main {     public static void main(String[] args) {         Base b = new Derived();;         b.show();     } }
    • A. 

      20

    • B. 

      0

    • C. 

      Compile time error

    • D. 

      Garbage Value

  • 11. 
    What is the output of this program?     #include <cstdlib>     #include <iostream>     using namespace std;     int main()     {         int ran = rand();         cout << ran << endl;     }
    • A. 

      Any Number

    • B. 

      89

    • C. 

      0​ to RAND_MAX

    • D. 

      None

  • 12. 
    What is the meaning of the following declaration? int(*p[5])();
    • A. 

      P is pointer to function

    • B. 

      P is array of pointer to function

    • C. 

      P is pointer to such function which return type is the array

    • D. 

      P is pointer to array of function

  • 13. 
    What is the output of below code snippet?    double a = 0.02;    double b = 0.03;    double c = b - a;    System.out.println(c);      BigDecimal _a = new BigDecimal("0.02");    BigDecimal _b = new BigDecimal("0.03");    BigDecimal _c = b.subtract(_a);    System.out.println(_c);
    • A. 

        0.009999999999999998    0.01

    • B. 

      0.01 0.009999999999999998

    • C. 

      0.01 0.01

    • D. 

      0.009999999999999998 0.009999999999999998

  • 14. 
    Which of these is a super class of Character wrapper?
    • A. 

      Long

    • B. 

      Digits

    • C. 

      Float

    • D. 

      Number

  • 15. 
    What is the output of this program?     class bitwise_operator      {         public static void main(String args[])          {                  int a = 3;              int b = 6;           int c = a | b;              int d = a & b;                           System.out.println(c + " "  + d);         }      }
    • A. 

      7 2

    • B. 

      7 7

    • C. 

      7 5

    • D. 

      5 2

  • 16. 
    What is the error in this code?     byte b = 50;     b = b * 50;
    • A. 

      B cannot contain value 100, limited by its range

    • B. 

      * operator has converted b * 50 into int, which can not be converted to byte without casting

    • C. 

      B cannot contain value 50

    • D. 

      No error in this code

  • 17. 
    What is the output of this program?     class recursion      {         int func (int n)          {             int result;             result = func (n - 1);             return result;         }     }      class Output      {         public static void main(String args[])          {             recursion obj = new recursion() ;             System.out.print(obj.func(12));         }     }
    • A. 

      0

    • B. 

      1

    • C. 

      Compile time error

    • D. 

      Run Time Error

  • 18. 
    What is the output of this program?     class recursion      {         int fact(int n)          {             int result;             if (n == 1)                 return 1;             result = fact(n - 1) * n;             return result;         }     }      class Output      {         public static void main(String args[])          {             recursion obj = new recursion() ;             System.out.print(obj.fact(6));         }     }
    • A. 

      1

    • B. 

      30

    • C. 

      120

    • D. 

      720

  • 19. 
    What is the difference between servlets and applets? i. Servlets execute on Server; Applets execute on browser ii. Servlets have no GUI; Applet has GUI iii. Servlets creates static web pages; Applets creates dynamic web pages iv. Servlets can handle only a single request; Applet can handle multiple requests
    • A. 

      I,ii,iii are correct

    • B. 

      I,ii are correct

    • C. 

      I,iii are correct

    • D. 

      I,ii,iii,iv are correct

  • 20. 
    Which of the following code retrieves the body of the request as binary data?
    • A. 

      DataInputStream data = new InputStream()

    • B. 

      DataInputStream data = response.getInputStream()

    • C. 

      DataInputStream data = request.getInputStream()

    • D. 

      DataInputStream data = request.fetchInputStream()

  • 21. 
    Which of these interface abstractes the output of messages from httpd?
    • A. 

      LogMessage

    • B. 

      LogResponse

    • C. 

      Httpdserver

    • D. 

      HttpdResponse

  • 22. 
    What is the output of this program?     class exception_handling      {         public static void main(String args[])          {             try              {                 int a[] = {1, 2,3 , 4, 5};                 for (int i = 0; i < 7; ++i)                      System.out.print(a[i]);             }             catch(ArrayIndexOutOfBoundsException e)              {             System.out.print("0");                         }         }     }
    • A. 

      12345

    • B. 

      123450

    • C. 

      1234500

    • D. 

      Compilation Error

  • 23. 
    What is the output of this program? public class Demo {   public static void main(String[] args)   {         Map<Integer, Object> sampleMap = new TreeMap<Integer, Object>();         sampleMap.put(1, null);          sampleMap.put(5, null);          sampleMap.put(3, null);          sampleMap.put(2, null);          sampleMap.put(4, null);           System.out.println(sampleMap);    } }
    • A. 

      {1=null, 2=null, 3=null, 4=null, 5=null}

    • B. 

      {5=null}

    • C. 

      Exception is thrown

    • D. 

      {1=null, 5=null, 3=null, 2=null, 4=null}

  • 24. 
    What is the output of this program?     import java.util.*;     class Bitset      {         public static void main(String args[])         {             BitSet obj = new BitSet(5);             for (int i = 0; i < 5; ++i)                 obj.set(i);             obj.clear(2);             System.out.print(obj.length() + " " + obj.size());         }     }
    • A. 

      4 64

    • B. 

      5 64

    • C. 

      5 128

    • D. 

      4 128

  • 25. 
    #include<iostream>  using namespace std;  class Point {      Point() { cout << "Constructor called"; }  };    int main()  {     Point t1;     return 0;  } 
    • A. 

      Compiler Error 

    • B. 

      Runtime Error 

    • C. 

      Constructor called 

    • D. 

      None

Back to Top Back to top