Java Important Questions
Java Important Questions
Java Important Questions
Sheet 1
1. Why so JavaScript and Java have similar name?
Ans: B
Ans: A
A. Microsoft
B. Navigator
C. LiveWire
D. Native
Ans: B
A. Microsoft
B. Navigator
C. LiveWire
D. Native
Ans: C
B. Varying randomly
Ans: A
A. Client-side
B. Server-side
C. Local
D. Native
Ans: A
A. The </script>
B. The <script>
Ans: A
Ans: C
A. Return a value
C. Accept parameters
Ans: C
A. 2names
B. _first_and_last_names
C. FirstAndLast
Ans: A
11. ______ tag is an extension to HTML that can enclose any number of
JavaScript statements.
A. <SCRIPT>
B. <BODY>
C. <HEAD>
D. <TITLE>
Ans: A
12. How does JavaScript store dates in a date object?
Ans: A
13. Which of the following attribute can hold the JavaScript version?
A. LANGUAGE
B. SCRIPT
C. VERSION
Ans: A
A. System.out.println("Hello World")
C. document.write("Hello World")
D. response.write("Hello World")
Ans: C
15. Which of the following way can be used to indicate the LANGUAGE
attribute?
A. <LANGUAGE="JavaScriptVersion">
B. <SCRIPT LANGUAGE="JavaScriptVersion">
Ans: C
A. <js>
B. <scripting>
C. <script>
D. <javascript>
Ans: C
17. What is the correct syntax for referring to an external script called " abc.js"?
Ans: C
Ans: B
19. Which of the following navigator object properties is the same in both
Netscape and IE?
A. navigator.appCodeName
B. navigator.appName
C. navigator.appVersion
Ans: A
Ans: C
Ans: A
22. If para1 is the DOM object for a paragraph, what is the correct syntax to
change the text within the paragraph?
A. "New Text"?
B. para1.value="New Text";
D. para1.nodeValue="New Text";
Ans: B
23. JavaScript entities start with _______ and end with _________.
A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon
Ans: D
Ans: D
A. FileUpLoad
B. Function
C. File
D. Date
Ans: C
A. Database
B. Cursor
C. Client
D. FileUpLoad
Ans: D
A. new
B. this
C. delete
D. typeof
Ans: B
A. Eval
B. ParseInt
C. ParseFloat
D. Efloat
Ans: A
29. Which of the following event fires when the form element loses the focus:
<button>, <input>, <label>, <select>, <textarea>?
A. onfocus
B. onblur
C. onclick
D. ondblclick
Ans: B
A. [objectName.]eval(numeriC.
B. [objectName.]eval(string)
C. [EvalName.]eval(string)
D. [EvalName.]eval(numeriC.
Ans: B
B. Server
C. Object
Ans: A
32. Using _______ statement is how you test for a specific condition.
A. Select
B. If
C. Switch
D. For
Ans: B
Ans: C
B. dateObjectName.new Date([parameters])
D. dateObjectName Date([parameters])
Ans: A
35. The _______ method of an Array object adds and/or removes elements from an
array.
A. Reverse
B. Shift
C. Slice
D. Splice
Ans: D
36. To set up the window to capture all Click events, we use which of the
following statement?
A. window.captureEvents(Event.CLICK);
B. window.handleEvents (Event.CLICK);
C. window.routeEvents(Event.CLICK );
D. window.raiseEvents(Event.CLICK );
Ans: A
A. <IMG>
B. <A>
C. <BR>
Ans: B
A. Pathname
B. Protocol
C. Defaultstatus
D. Host
Ans: C
39. To enable data tainting, the end user sets the _________ environment variable.
A. ENABLE_TAINT
B. MS_ENABLE_TAINT
C. NS_ENABLE_TAINT
D. ENABLE_TAINT_NS
Ans: C
40. In JavaScript, _________ is an object of the target language data type that
encloses an object of the source language.
A. a wrapper
B. a link
C. a cursor
D. a form
Ans: A
41. When a JavaScript object is sent to Java, the runtime engine creates a Java
wrapper of type ___________
A. ScriptObject
B. JSObject
C. JavaObject
D. Jobject
Ans: B
42. _______ class provides an interface for invoking JavaScript methods and
examining JavaScript properties.
A. ScriptObject
B. JSObject
C. JavaObject
D. Jobject
Ans: B
43. _________ is a wrapped Java array, accessed from within JavaScript code.
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
Ans: A
44. A ________ object is a reference to one of the classes in a Java package, such
as netscape.javascript .
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
Ans: B
A. netscape.javascript.JSObject
B. netscape.javascript.JSException
C. netscape.plugin.JSException
Ans: B
46. To automatically open the console when a JavaScript error occurs which of the
following is added to prefs.js?
A. user_pref(" javascript.console.open_on_error", false);
D. user_pref("javascript.console.open_on_error", true);
Ans: D
47. To open a dialog box each time an error occurs, which of the following is
added to prefs.js?
A. user_pref("javascript.classic.error_alerts", true);
Ans: A
A. Blur()
B. Blur(contrast)
C. Blur(value)
D. Blur(depth)
Ans: A
49. The syntax of capture events method for document object is ______________
A. captureEvents()
B. captureEvents(args eventType)
C. captureEvents(eventType)
D. captureEvents(eventVal)
Ans: C
B. Close(object)
C. Close(val)
D. Close()
Ans: D
A. 44
B. 8
C. 4
D. Error output
Ans: A
A. True B. False
Ans: A
Ans: A
Ans: C
A. Database
B. Cursor
C. Client
D. FileUpLoad
Ans: D
Ans: A
A. False B. True
Ans: A
B. Error
C. 7
D. 78
Ans: D
A. 9123
B. 91234
C. 80000
Ans: A
a) 44
b) 8
c) 4
d) Error output
document.write(result);
</script>
a) Quality
b) Q,u,a,l,i,t,y,P,o,i,n,t,T,e,c,h,n,o,l,o,g,i,e,s
c) Qualiyt,Point,Technologies
d) QualityPointTechnologies
a) True
b) False
4) <script>
document.write(navigator.appCodeName);
< /script>
Show Answer
8) <script language="javascript">
function x()
document.write(output);
</script>
a) Good %
b) 1,0,0
c) G,o,o,d,%
d) Error
9) <script language="javascript">
alert(qpt.charAt(qpt.length-1));
</script>
a) P
b) E
c) S
d) Error
a) Database
b) Cursor
c) Client
d) FileUpLoad
a) NO
b) YES
a) (a) only
b) (b) only
function x(z,t)
alert(x.length);
< /script>
output:
?
a) Error
b) 2
c) 1
d) 3
a) False
b) True
c) None of above
a) 20
b) -21
c) 19
d) None
a) %,!,{,[,!,!
b) Q,u,a,l,i,t,y,1,0,0
c) Quality 100
d) Error
qpt[0] = "WebDevelopment";
qpt[1]="ApplicationDevelopment"
qpt[2]="Testing"
qpt[3] = "QualityPointTechnologies";
document.write(qpt[0,1,2,3]);
</script>
a) Error
b) QualityPointTechnologies
c) WebDevelopment
d) WebDevelopmnet,ApplicationDevelopment,Testing,QualityPointTechnologies
a) FileUpLoad
b) Function
c) File
d) Date
20) parseFloat(9+10)=?
a) 19
b) 910
c) None
function x()
{
document.write(2+5+"8");
</script>
a) 258
b) Error
c) 7
d) 78
a) Var
b) Dim
c) String
23) In Javascript, Which of the following method is used to evaluate the regular
expression?
a) eval(2*(3+5))
b) evaluate(2*(3+5))
c) evalu(2*(3+5))
function x()
</script>
a) 100
b) 1,0,0
c) q,u,a,l,i,t,y,%
d) Error
document.write(qpt);
</script>
a) hello
b) bye
a) Error
b) POIiNT
c) Point
d) null
29) If x=103 & y=9 then x%=y , what is the value of x after executing x%=y?
a) 4
b) 3
c) 2
d) 5
a) Date
b) Option
c) Layer
d) Checkbox
31) Choose the four symbol pairs that represent RegExp properties lastMatch,
lastParent,
33) ParseInt(“15”,10)=?
a) 15
b) 10
c) 151
d) 150
a) Object signing
b) Style sheets
c) Netcaster channels
d) Image rollovers
a) True
b) False
c) None of above
function x()
var qpt = "We are fast growing Software Company located in Chennai, India.";
} </script>
a) in in In
b) in in in
c) in in null
d) in null null
a) Yes
b) No
a) -21
b) 20
c) -20
d) 21
a) Yes
b) No
function x()
document.write(qpt.match(pattern)[1]);
</script>
a) first
b) undefined
c) First
d) Error
(c). /*......*/ , //
(d). \*......*\ , //
a) Only (d)
b) Only (c)
d) Only (b)
function x()
{
document.write(output);
</script>
a) ,%,!,{,[,!,!
b) G,i,v,e,1,0,0
c) Give 100
d) Error
a) A method
b) A function
c) A statement
d) An operator
var qpt="QualityPointTechnologies";
document.write(result);
</script>
a) 3
b) 18
c) 17
d) 19
function x()
document.write(qpt.match(pattern)[1]);
</script>
a) first
b) First
c) undefined
function sum(x)
function add(y)
return x+y;
return add;
</script>
If you call the function callme(), what will happen ?
a) 10
c) 5
a) Tennis Ritchie
b) James Gosling
c) Brendan Eich
document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph.</p>");
</script>
a) No
b) Yes
c) Impossible
a) split()
b) document.clear()
c) join()
d) charAt()
51) How to speicfy the color of the hypertext links with JavaScript ?
a) document.linkColor="#00FF00";
b) document.LColor="#00FF00";
c) document.LinkC="#00FF00";
d) document.hyperTextLink="#00FF00":
function x()
</script>
a) Position-7
b) Position-1
c) null
d) error
a) setHours()
b) setMinutes()
c) parse()
a) eval
b) ParseInt
c) ParseFloat
d) None
a) eval
b) parseFloat
c) parseInt
d) None
a) path
b) host
c) secure
d) domain
a) interface
b) short
c) program
d) throws
59) In Javascript, Which of the following method is used to find out the character
at a
position in a string?
a) charAt()
b) CharacterAt()
c) CharPos()
d) characAt()
document.write(result);
</script>
a) Po
b) yP
c) oi
d) P
a) Set it to false.
b) Set it to null.
c) Set it to undefined.
d) Set it to -1
a) Yes
b) No
63) JavaScript RegExp Object has modifier 'i' to __________
64) What are the following looping structures are available in javascripts?
a) for,forecach
b) foreach,whileloop
c) do-while loop,foreach
a) atan()
b) atan2()
c) eval()
d) acos()
document.write(output);
</script>
a) 9123
b) 91234
c) 80000
_________
a) true or false
b) found value
c) index
68) What property would you use to redirect a visitor to another page?
a) document.URL
b) window.location.href
c) .document.location.href
d) link.href
Question:
In javascript, which of the above statement can used for string declaration ?
b) Only (a)
d) Only (b)
document.write(result);
</script>
a) 11
b) 12
c) 15
d) 13
function x()
document.write(pattern.exec(s));
</script>
a) Eat
b) eat
c) undefined
d) Eat eat
function x()
var qpt = "We are fast growing Software Company located in Chennai, India.";
a) in in In
b) in in in
c) in in null
d) in null null
73) -------------- method is used to remove focus from the specified object.
a) blur()
b) focus()
c) None
74) parseFloat(“FF2”)=?
a) 152
b) FF2
c) NaN
d) None
Show Answer
75)eval((20*4)=?
a) Nan
b) 204
c) 24
d) 80
76)<script language="javascript">
function x()
document.write(qpt.match(pattern));
}
</script>
a) null
b) Technologies
c) TECHNOLOGIES
d) Error
a) tightly
b) loosely