Java MCQs with Answer


Java MCQs with Answer


Java MCQs with Answer





  1. Java programs are


  2. (a) Faster than others

    (b) Platform independent

    (c) Not reusable

    (d) Not scalable




    (b) Platform independent






  3. Java has its origin in


  4. (a) C programming language

    (b) PERRL

    (c) COBOL

    (d) Oak programming language




    (d) Oak programming language






  5. Which one of the following is true for Java


  6. (a) Java is object oriented and interpreted

    (b) Java is efficient and faster than C

    (c) Java is the choice of everyone.

    (d) Java is not robust.




    (a) Java is object oriented and interpreted






  7. The command javac is used to


  8. (a) debug a java program

    (b) compile a java program

    (c) interpret a java program

    (d) execute a java program




    (b) compile a java program






  9. Java servlets are an efficient and powerful solution for
    creating ………….. for the web.


  10. (a) Dynamic content

    (b) Static content

    (c) Hardware

    (d) Both a and b




    (a) Dynamic content






  11. Filters were officially introduced in the Servlet ___________ specification.


  12. (a) 2.1

    (b) 2.3

    (c) 2.2

    (d) 2.4




    (b) 2.3






  13. Which is the root class of all AWT events


  14. (a) java.awt.ActionEvent

    (b) java.awt.AWTEvent

    (c) java.awt.event.AWTEvent

    (d) java.awt.event.Event




    (c) java.awt.event.AWTEvent






  15. OOP features are


  16. i) Increasing productivity
    ii) Reusability
    iii) Decreasing maintenance cost
    iv) High vulnerability
    (a) 1,2 & 4

    (b) 1,2 & 3

    (c) 1, 2 & 4

    (d) none of the above




    (b) 1,2 & 3






  17. break statement is used to


  18. i) get out of method
    ii) end aprogram
    iii) get out of a loop
    iv) get out of the system

    (a) 1 & 2

    (b) 1,2 & 3

    (c) 1 & 3

    (d) 3




    (d) 3







  19. Native – protocol pure Java converts ______ into the ______ used by DBMSs directly.


  20. (a) JDBC calls, network protocol

    (b) ODBC class, network protocol

    (c) ODBC class, user call

    (d) JDBC calls, user call




    (a) JDBC calls, network protocol






  21. The JDBC-ODBC bridge allows ……….. to be used as ………..


  22. (a) JDBC drivers, ODBC drivers

    (b) Drivers, Application

    (c) ODBC drivers, JDBC drivers

    (d) Application, drivers




    (c) ODBC drivers, JDBC drivers






  23. Which of the following is true about Java.


  24. (a) Java does not support overloading.

    (b) Java has replaced the destructor function of C++

    (c) There are no header files in Java.

    (d) All of the above.




    (d) All of the above






  25. _______ are not machine instructions and therefore, Java interpreter generates machine code that can be directly executed by the machine that is running the Java program.

  26. (a) Compiled Instructions

    (b) Compiled code

    (c) byte code

    (d) Java mid code




    (c) byte code






  27. The command javac


  28. (a) Converts a java program into binary code

    (b) Converts a java program into bytecode

    (c) Converts a java program into machine language

    (d) None of the above.




    (b) Converts a java program into bytecode






  29. Which of the following is not the java primitive type


  30. (a) Byte

    (b) Float

    (c) Character

    (d) Long double




    (d) Long double






  31. Command to execute compiled java program is


  32. (a) java

    (b) javac

    (c) run

    (d) javaw




    (a) java







  33. Java Servlet


  34. i) is key component of server side java development
    ii) is a small pluggable extension to a server that enhances functionality
    iii) runs only in Windows Operating System

    iv) allows developers to customize any java enabled server

    (a) i, ii & iii are ture

    (b) i, iii & iv are true

    (c) ii, iii & iv are true

    (d) i, ii & iv are true




    (d) i, ii & iv are true







  35. Inner classes are


  36. (a) anonymous classes

    (b) nested classes

    (c) sub classes

    (d) derived classes




    (b) nested classes







  37. How many times does the following code segment execute/


  38. int x=1, y=10, z=1;
    do{
    y–;
    x++;
    y-=2;
    y=z;
    z++
    } while (y>1 && z<10);



    (a) 1

    (b) 10

    (c) 5

    (d) infinite




    (a) 1








  39. State weather the following statement is true or false for EJB.


  40. 1. EJB exists in the middle-tier
    2. EJB specifies an execution environment
    3. EJB supports transaction processing
    (a) 1-true, 2. true, 3. true

    (b) 1- true, 2. false, 3. true

    (c) 1- false, 2- false, 3- false

    (d) 1-true, 2-true, 3-false




    (a) 1-true, 2. true, 3. true







  41. All java classes are derived from


  42. (a) java.lang.Class

    (b) java.util.Name

    (c) java.lang.Object

    (d) java.awt.Window




    (c) java.lang.Object







  43. The jdb is used to


  44. (a) Create a jar archive

    (b) Debug a java program

    (c) Create C header file

    (d) Generate java documentation




    (b) Debug a java program






  45. What would happen if "String[]args" is not included as argument
    in the main method.


  46. (a) No error

    (b) Compilation error

    (c) Program won’t run

    (d) Program exit




    (c) Program won’t run






  47. For execution of DELETE SQL query in JDBC,______ method must be used.


  48. (a) executeQuery()

    (b) executeDeleteQuery()

    (c) executeUpdate()

    (d) executeDelete()




    (c) executeUpdate()






  49. Which method will a web browser call on a new applet?


  50. (a) main method

    (b) destroy method

    (c) execute method

    (d) init method




    (d) init method






  51. Which of the following is not mandatory in variable declaration?


  52. (a) a semicolon

    (b) an identifier

    (c) an assignment

    (d) a data type




    (c) an assignment






  53. When a program class implements an interface, it must
    provide behavior for


  54. (a) two methods defined in that interface

    (b) any methods in a class

    (c) only certain methods in that interface

    (d) all methods defined in that interface




    (d) all methods defined in that interface






  55. In order to run JSP ……………….. is required.


  56. (a) Mail Server

    (b) Applet viewer

    (c) Java Web Server

    (d) Database connection




    (c) Java Web Server






  57. State true of false.


  58. i) AWT is an extended version of swing

    ii) Paint( ) of Applet class cannot be overridden

    (a) i-false, ii-false

    (b) i-false,ii-true

    (c) i-true, ii-false

    (d) i-true, ii-true




    (a) i-false, ii-false






  59. Prepared Statement object in JDBC used to execute _____ queries.


  60. (a) Executable

    (b) Simple

    (c) High level

    (d) Parameterized




    (d) Parameterized






  61. In Java variables, if first increment of the variable takes
    place and then the assignment occurs. This operation is also called ______.


  62. (a) pre increment

    (b) post increment

    (c) incrementation

    (d) pre incrementation




    (d) pre incrementation






  63. When the operators are having the same priority, they are
    evaluated from _______ __________ in the order they appear in the expression.


  64. (a) right to left

    (b) left to right

    (c) any of the order

    (d) depends on compiler




    (b) left to right






  65. In java, ________ can only test for equality, where as ________ can evaluate any type of the
    Boolean expression.


  66. (a) switch, if

    (b) if, switch

    (c) if, break

    (d) continue, if




    a) switch, if






  67. The ______ looks only for a match between the value of the expression and one of its
    case constants.


  68. (a) if

    (b) match

    (c) switch

    (d) None of the above




    (c) switch






  69. System.in.read() is being used, the program must specify the _______ clause.


  70. (a) throws.java.out.IOException

    (b) throws.java.in.IOException

    (c) throws.java.io.IOException

    (d) throws.java.io.InException




    (c) throws.java.io.IOException






  71. By using____________ you can force immediate termination of a loop,
    by passing the conditional expression and any remaining code in the
    body of the
    loop.


  72. (a) Break

    (b) Continue

    (c) Terminate

    (d) Loop Close




    (a) Break






  73. The out object is an object encapsulated inside the___________
    class, and represents the standard output device.


  74. (a) standard

    (b) local

    (c) globlal

    (d) system




    (d) system






  75. The third type of comment is used by a tool called _______ for
    automatic generation of documentation.


  76. (a) Java commenting

    (b) Java generator

    (c) Java doc

    (d) Java loc




    (c) Java doc






  77. In the second type the information written in java after // is
    ignored by the ______.


  78. (a) Interpreter

    (b) Compiler

    (c) Programmer

    (d) All of the above




    (b) Compiler






  79. The compiled java program can run on any ______ plateform having Java Virtual
    Machine (JVM) installed on it.


  80. (a) program

    (b) java

    (c) hardware

    (d) non java




    (b) java






  81. Preparedstatement Object in JDBC is used to execute __________ queries.


  82. (a) executable

    (b) simple

    (c) high level

    (d) parameterized




    (d) parameterized






  83. In JDBC _________imports all Java classes concerned with
    database connectivity.


  84. (a) javax.sql.*

    (b) java.mysql.*

    (c) java.sql.*

    (d) com.*




    (a) javax.sql.*






  85. MS-SQL stores data in a …………………… file format.


  86. (a) .DAT

    (b) .MDB

    (c) .MSSQL

    (d) .OBJ




    (a) .DAT






  87. Ingres is a _______.


  88. (a) Socket

    (b) Compiler

    (c) Database

    (d) Web server




    (c) Database







Related Topics

"Java MCQs with Answer","java mcq questions with answers pdf","advanced java mcq questions with answers pdf","java mcq questions for placement","java mcq online test","Java MCQ ","Java MCQ Questions and Answer","readmcqs.com","ReadMCQs.com"



Comments

Popular posts from this blog

Formal and informal Letter writing MCQs

Reading Skills MCQs

Literary Criticism MCQs with Answers