www.javaassignmenthelp.net
List Of Best Java Multiple Choice Questions andAnswers
Advanced java multiple choice questions and answers will help you to be moreknowledgeable because they can give you ideas on questions and answers. Check out this page tolearn of the best Java multiple choice Q&As.
List of Advanced Java Multiple Choice Questions
Java swing multiple choice questions and answers are important to know, especially if youwant to pass. The questions will be your basis on what you need to learn.
1. Why Java and JavaScript have same name?
a) JavaScript works as a version stripped-down of the Javab) Both are originated in island of the Javac) Javacript’s syntax is based on the Java’s
www.javaassignmenthelp.net
Answer: c
2. If you will view the JavaScript page, which machine will execute the so-called script?
a) Machine running the online browserb) Central machine within the Netscapes corporate officesc) Web server
Answer: a
3. ____JavaScript is referred as client-side.
a) Livewireb) Nativec) Microsoft
Answer: a
4. What variables are being used in the programs for the JavaScript?
a) Dates, stroning numbers and othersb) Algebra flashbacksc) Varying randomly
Answer: a
www.javaassignmenthelp.net
5. ____ JavaScript statement embedded in the HTML page responding to the user events?
a) Server-sideb) Nativec) Client-side
Answer: c
6. In the end of the JavaScript, what will appear?
a) The <script>b) The </script>c) End statement
Answer: b
7. What cannot be done in the client-side of the JavaScript?
a) Storing forms contents to file database on serverb) Sending forms contentsc) Validating form
Answer: a
8. Which are the capabilities functions in the JavaScript?
a) Accept parametersb) Return the value and accept parametersc) Return the value
Answer: a
www.javaassignmenthelp.net
9. Which is invalid variable name of JavaScript?
a) First and last namesb) First and lastc) 2names
Answer: c
10.____ tag is the extension to the HTML enclosing number of the JavaScript statement.
a) <SCRIPT>b) <TITLE>c) <HEAD>
Answer: a
11.How the JavaScript store dates in date object?
a) The number of the milliseconds since 1st January 1970b) The number of the days since 1st January1900c) No answer
Answer: a
12. Which attribute will able to hold JavaScript version?
a) LANGUAGEb) VERSION
www.javaassignmenthelp.net
c) SCRIPT
Answer: a
13.What JavaScript syntax is correct in writing the "Hello World"?
a) println ("Hello World")b) System.out.println("Hello World") c) document.write("Hello World")
Answer: c
14.Which way can be used in indicating LANGUAGE attribute?
a) <SCRIPT LANGUAGE="JavaScriptVersion"!> JavaScript statements…</SCRIPT>b) <SCRIPT LANGUAGE="JavaScriptVersion">c) <SCRIPT LANGUAGE="JavaScriptVersion"> JavaScript statements…</SCRIPT>
Answer: c
15.In what HTML element you put JavaScript?
a) <js>b) <scripting>c) <script>
Answer: c
16.What correct syntax referring to the external script called " abc.js"?
a) <script href=" abc.js">b) script src=" abc.js">
www.javaassignmenthelp.net
c) <script name=" abc.js”>
Answer: b
17.Which image maps types can be used with the JavaScript?
a) Server-side image mapsb) Server-side image maps and the Client-side image mapsc) Client-side image maps
Answer: c
18.Which navigator object properties is the same in both IE and Netscape?
a) navigator.appCodeNameb) navigator.appVersionc) navigator.appName
Answer: a
19.Correct way in writing the JavaScript array?
a) var txt = new Array("tim","kim","jim")b) var txt = new Array:1=("tim")2=("kim")3=("jim")c) var txt = new Array="tim","kim","jim"
Answer: a
www.javaassignmenthelp.net
20.What does <noscript> tag do?
a) Enclose text that to be displayed by the non-JavaScript browsersb) Describes certain low-budget movies.c) Prevents scripts on page from executing.
Answer: a
21. If para1 is DOM object for a paragraph, then what is the correct syntaxin changing text within the paragraph?
a) para1.value="New Text";b) "New Text"?c) para1.nodeValue="New Text";
Answer: a
22.JavaScript entities begin with the _______ and end with the _________.
a) Semicolon, colonb) Ampersand, colonc) Ampersand, semicolon
Answer: c
23.Which best describes the JavaScript?
a) a scripting language precompiled in the browser.b) a compiled scripting language.c) an object-oriented scripting language.
Answer: b
www.javaassignmenthelp.net
24.Choose the JavaScript object server-side?
a) Fileb) Datec) FileUpLoad
Answer: a
25.Choose the client-side JavaScript object?
a) Databaseb) Clientc) FileUpLoad
Answer: c
26.Which is not considered as a JavaScript operator?
a) Newb) Deletec) This
Answer: c
27. ______method evaluates the string of the JavaScript code in context of the specified object.
a) Evalb) Efloat
www.javaassignmenthelp.net
c) ParseFloat
Answer: a
28.Event fires when form element loses the focus: <button>, <input>, <label>, <select>, <textarea>?
a) Onfocusb) Onblurc) Onclick
Answer: b
29.The syntax of the Eval is?
a) [objectName.]eval(numeriC.b) [objectName.]eval(string)c) [EvalName.]eval(string)
Answer: b
30.JavaScript is interpreted by the?
a) Server b) Clientc) Object
Answer: b
www.javaassignmenthelp.net
31.In testing specific condition, you will use ___ statement.
a) Selectb) Forc) Switch
Answer: c
32.Which is structure of the if statement?
a) if (conditional expression is true) thenexecute this codeend ifb) if (conditional expression is true) {then execute this code>->}c) if (conditional expression is true)execute this codeend if
Answer: b
33.How you create Date object in the JavaScript?
a) dateObjectName Date([parameters])b) dateObjectName = new Date([parameters])c) dateObjectName := new Date([parameters])
Answer: b
34._______ method of the Array object adds and/or removes elements fromthe array.
a) Reverseb) Splicec) Slice
Answer: b
www.javaassignmenthelp.net
35.In setting up window to capture click events, what do you use?
a) window.captureEvents(Event.CLICK);b) window.handleEvents (Event.CLICK);c) window.routeEvents(Event.CLICK );
Answer: a
36.Which tag can handle the mouse events in the Netscape?
a) <A>b) <BR>
Answer: a
37. ____________ is tainted property of window object.
a) Pathnameb) Hostc) Defaultstatus
Answer: c
38.In enabling data tainting, end user sets ____ environment variable.
a) ENABLE_TAINTb) NS_ENABLE_TAINTc) ENABLE_TAINT_NS
Answer: b
www.javaassignmenthelp.net
39.In JavaScript, the _________ is object of target language data type enclosing the object of source language.
a) a form b) a wrapperc) a cursor
Answer: b
40.When the JavaScript object is being sent to the Java, the runtime enginewill create a Java wrapper of what type?
a) ScriptObjectb) JavaObjectc) JSObject
Answer: c
41.The _______ class is providing interface that invokes JavaScript methods as well as examining JavaScript properties.
a) ScriptObjectb) JSObjectc) Jobject
Answer: b
www.javaassignmenthelp.net
42.The _________ is a wrapped Java array that accessed from JavaScript code.
a) JavaPackage b) JavaArrayc) JavaObject
Answer: b
43.The ________ object is reference to 1 of classes in the Java package like netscape.javascript .
a) JavaClassb) JavaPackagec) JavaObject
Answer: a
44.JavaScript exception is available to Java code as instance of?
a) netscape.javascript.JSObjectb) netscape.plugin.JSExceptionc) netscape.javascript.JSException
Answer: c
45.To automatically open console if a JavaScript mistake occurs which is added to the prefs.js?
a) user_pref(" javascript.console.open_on_error", false);b) user_pref("javascript.console.open_on_error", true);
www.javaassignmenthelp.net
c) user_pref("javascript.console.open_error ", false);
Answer: c
46.In order to open the dialog box every time a mistake occurs, which is added to prefs.js?
a) user_pref("javascript.classic.error_alerts", true);b) user_pref("javascript.console.open_on_error ", false);c) user_pref("javascript.classic.error_alerts ", false);
Answer: a
47.Syntax of the blur method in the button object is?
a) Blur(value)b) Blur()c) Blur(depth)
Answer: b
48.Syntax of the capture events method for a document object is?
a) captureEvents()b) captureEvents(args eventType)c) captureEvents(eventType)
Answer: c
www.javaassignmenthelp.net
49.Syntax of the close method for a document object is?
a) Close(doC.b) Close(object)c) Close()
Answer: c
50.<script type="text/javascript">x=4+"4";document.write(x);</script>the output is ?
a) 4b) 8c) 44
Answer: c
51.It is possible to nest functions in the JavaScript?
a) Trueb) False
Answer: a
www.javaassignmenthelp.net
52.<script>document.write(navigator.appCodeName);</script>
a) get code name of the browser of a visitorb) set code name of the browser of a visitor
Answer: a
53.Scripting language are?
a) High Level Programming languageb) Machine level programming language
Answer: a
54.Which explains getSelection()?
a) Returns VALUE of a selected OPTION..b) Returns value of cursor-selected textc) Returns VALUE of a checked radio input
Answer: b
55.Choose the client-side JavaScript object:
a) Databaseb) Cursorc) FileUpLoad
Answer: c
www.javaassignmenthelp.net
56.Define the meaning of "this" keyword in the javascript?
a) It refers to the current objectb) It’s variable containing valuec) It refers to the previous object
Answer: a
57.In JavaScript, Window.prompt() method return true or false value ?
a) Falseb) True
Answer: a
58.<script language="javascript">function x(){document.write(2+5+"8");}</script>
a) 258b) Errorc) 7d) 78
Answer: d
www.javaassignmenthelp.net
59.<script type="text/javascript">var s = "9123456 or 80000?";var pattern = /\d{4}/;var output = s.match(pattern);document.write(output);</script>
a) 9123b) 91234c) 80000
Answer: a
60.Test and tags are not displayed directly on page are written in _____ section.
a) <html>b) <head>c) <title>d) <body>
Answer: b
61.Which tag inserts a line horizontally on web page?
a) <hr>b) <line>c) <line direction=”horizontal”>d) <tr>
Answer: a
www.javaassignmenthelp.net
62.What should be the first tag in the HTML document?
a) <head>b) <title>c) <html>d) <document>
Answer: c
63.The JDBC-ODBC bridge allows _______to be used as________.
a) ODBC drivers, JDBC drivers
b) Application, drivers
c) ODBC drivers, JDBC drivers
d) drivers, application
Answer: c
64. Which is true about Java.
a) Java doesn’t support the overloading.
b) Java has replaced the destructor function of the C++
c) There are no any header files in the Java.
d) All of the above.
Answer: d
www.javaassignmenthelp.net
65. ______are not machine instructions and the Java interpreter generate
machine codes that is directly executed by machine running the Java
program.
a) Compiled Instructions
b) Compiled code
c) byte code
d) Java mid code
Answer: c
66. The command javac
a) Converts the java program to binary code
b) Converts the java program to bytecode
c) Converts the java program to machine language
Answer: b
67. Which is not primitive type of Java
a) Float
b) Byte
c) Character
d) Long double
Answer: d
www.javaassignmenthelp.net
68.Command to execute compiled java program is?
a) java
b) run
c) javac
d) javaw
Answer: a
69.Java Servlet?
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()
Answer: d
70.Inner classes are?
a) anonymous classes
b) nested classes
c) sub classes
www.javaassignmenthelp.net
d) derived classes
Answer: b
71.How many times does code segment execute
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
Answer: a
72.State if the statement is true or false for EJB.
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
Answer: a
www.javaassignmenthelp.net
73.Prepared statement object in the JDBC is being used to ins executing ____ queries.
a) Executable
b) simple
c) high level
d) parameterized
Answer: d
74. In JDBC, ____ imports all Java classes that is concerned with the database connectivity.
a)javax.sql.*b)java.mysql.*c)java.sql.*d) com.*Answer: c
75. MS-SQL is storing data in _____ file format.
a) .DATb) .MDBc) .MSSQLd) .OBJ
Answer: a
76. Ingres is a?
a) Socketb) Compilerc) Database
www.javaassignmenthelp.net
d) Web serverAnswer: c
77. In Java servlet method init( ) is called ______ times.
a) 1b) 2c) 0d) multipleAnswer: a
78. State if it is true or false for Java Program.
i) All class variables are instance variablesii) All protected methods are friendly methodsa) i-false, ii-falseb) i-false, ii-truec) i-true, ii-falsed) i-true, ii-trueAnswer: b
79. State true or false for Java Program.
i) Data members of an interface are by default finalii) An abstract class has implementations of all methods defined inside it.a) i-false, ii-falseb) i-false, ii-truec) i-true, ii-falsed) i-true, ii-trueAnswer: c
80. The _____ of remotely accessible object should implement?
a) all methods, RemoteException
www.javaassignmenthelp.net
b) class, RemoteExceptionc) class, RemoteInterfaced) all methods, RemoteInterfaceAnswer: c
81. The ____is the key to______.
a) Serialization, persistenceb) Persistence, inheritancec) Inheritance, objectd) Persistence, serializationAnswer: a
82. A method name myMethod( ) that needs 2 integer arguments is declaredas?
a) public void myMethod( );b) public void myMethod(int a, int b);c) public void myMethod(int a, b);d) public int myMethod(a, b);Answer: b
83. JSP embeds in_____ in _____.
a) Servlet, HTML
b) HTML, Java
c) HTML, Servlet
d) Java, HTML
Answer: d
84. The class at top of the exception class hierarchy is?
www.javaassignmenthelp.net
a) ArithmeticException
b) Throwable
c) Class
d) Exception
Answer: b
85. In the java program, the package declaration ____ import statements.
a) must precede
b) must succeed
c) may precede or succeed
d) none
Answer: a
86. Class string belongs to the ____package.
a) java.awt
b) java.lang
c) java.applet
d) java.string
Answer: d
87. ______package is being used by the compiler itself. So, it doesn’t need to
be imported for use.
a) java.math
b) java.awt
www.javaassignmenthelp.net
c) java.applet
d) java.lang
Answer: d
88. State if it is true or false.
i) Java beans slow down software development process.
ii) Java Servlets does not have built in multithreading feature.
a) i-false, ii-false
b) i-false, ii-true
c) i-true, ii-false
d) i-true, ii-true
Answer: a
89. State if it is true or false.
i) init( ) of servlet is called after a client request comes in
ii) Servlets are ultimately converted into JSP
a) i-false, ii-false
b) i-false, ii-true
c) i-true, ii-false
d) i-true, ii-true
Answer: a
www.javaassignmenthelp.net
90. What will be the result of compiling following code.
public class MyClass{
public static void main(String args[]){
System.out.println("In first main()");
}
public static void main(char args[]){
System.out.println('a');
}
}
a) Code will not compile and will give "Duplicate main() method declaration" error
b) Code will compile correctly but will give a runtime exception
c) Code will compile correctly and will print "In first main()" (without quotes) when it is run
d) Code will compile correctly and will print "a" (without quotes) when it is run
Answer: c
91. Match the following.
a) Java 1) is a tool for debugging java program
b) Javah 2) is a tool for creating C-like header files
c) Javap 3) runs java bytecode
d) jdb 4) prints java code representation
a) a-3, b-2,c-1
b) a-3, b-2, c-4, d-1
c) a-1, b-2, c-3, d-4
d) a-2, b-1, c-3, d-4
www.javaassignmenthelp.net
Answer: b
92. State if it is true or false.
i) init() is called after start() in applet
ii) applets are used for networking
iii) inheritance is a part of Java Foundation Classes
iv) final does not prevent inheritance
a) i-true, ii-true, iii-false, iv-true
b) i-false, ii-false, iii-false, iv-false
c) i-true, ii-true, iii-true, iv-true
d) i-true, ii-false, iii-false, iv-false
Answer: b
93. The ____and the ____classes are abstract classes supporting reading and writing of the byte streams.
a) reader, writerb) inputstream, outputstreamc) objectinputstream, objectoutputstreamd) noneAnswer: b
94. What is error in the code?
class Test { abstract void display( ); }
www.javaassignmenthelp.net
a) No errorb) Method display( ) should be declared as staticc) Test class should be declared as abstractd) Test class should be declared as publicAnswer: c
95. A package is a collection of?
a) classesb) interfacesc) editing toolsd) classes and interfacesAnswer: d
96. Which methods belong to string class?
a) length( )b) compare To ( )c) equals ( )d) All of themAnswer: d
97. What is the output of the code?
byte x=64, y; y= (byte) (x<<2); System.out.println(y);
a) 0b) 1c) 2d) 64Answer: a
www.javaassignmenthelp.net
98. If m and the n are int type variables, what is result of the expression
m%n when m=5 and n=2 ?a) 0b) 1c) 2d) None of the aboveAnswer: b
99. Which of the control expressions are valid when it comes to if statement?
a) An integer expressionb) A Boolean expressionc) Either A or Bd) Neither A nor BAnswer: b
100. The concept of the multiple inheritance is being implemented in the Java by?
a) extending two or more classesb) extending one class and implementing one or more interfacesc) implementing two or more interfacesd) both b and cAnswer: b
There you have java multiple choice interview questions that you may want topractice with so that you can study and learn of Java. If you need Java
assignment help, feel free to contact us!