Sunday, 6 November 2016

JavaScript Multiple Choice Questions and Answers Set- 02

JavaScript Multiple Choice Questions and Answers

1.  Why so JavaScript and Java have similar name?
A.  JavaScript is a stripped-down version of Java
B.  JavaScript's syntax is loosely based on Java's
C.  They both originated on the island of Java
D.  None of the above
Ans: B

2.  When a user views a page containing a JavaScript program, which machine actually executes the script?
A.  The User's machine running a Web browser
B.   The Web server
C.  A central machine deep within Netscape's corporate offices
D.  None of the above
Ans:  A

3.  ______ JavaScript is also called client-side JavaScript.
A.  Microsoft
B.  Navigator
C.  LiveWire
D.  Native
Ans: B

4.  __________ JavaScript is also called server-side JavaScript.
A.  Microsoft
B.   Navigator
C.  LiveWire
D.  Native
 Ans: C

5.  What are variables used for in JavaScript Programs?
A.  Storing numbers, dates, or other values
B.   Varying randomly
C.  Causing high-school algebra flashbacks
D.  None of the above
 Ans: A

6.  _____ JavaScript statements embedded in an HTML page can respond to user events such as mouse-clicks, form input, and page navigation.
A.  Client-side
B.   Server-side
C.  Local
D.  Native
 Ans: A

7.  What should appear at the very end of your JavaScript?
The
B.    The
D. 
 Ans: C

16.  Inside which HTML element do we put the JavaScript?
A. 
B.  
C.   


Output------?

A. 44
B. 8
C. 4
D. Error output
Ans: A

52. Is it possible to nest functions in JavaScript?
A. True
B. False
Ans: A

53.
A. get code name of the browser of a visitor
B. set code name of the browser of a visitor
C. None of the above
Ans: A

54. Scripting language are
A. High Level Programming language
B. Assembly Level programming language
C. Machine level programming language
Ans: A

55. Which best explains getSelection()?
A. Returns the VALUE of a selected OPTION.
B. Returns document.URL of the window in focus.
C. Returns the value of cursor-selected text
D. Returns the VALUE of a checked radio input.
Ans: C

56. Choose the client-side JavaScript object:
A. Database
B. Cursor
C. Client
D. FileUpLoad
Ans: D

57. What is mean by "this" keyword in javascript?
A. It refers current object
B. It referes previous object
C. It is variable which contains value
D. None of the above
Ans: A

58. In JavaScript, Window.prompt() method return true or false value ?
A. False
B. True
Ans: A

59.  
A. 258
B. Error
C. 7
D. 78
Ans: D

60.
A. 9123
B. 91234
C. 80000
D. None of the above
Ans: A

Q 1 - Is JavaScript a case-sensitive language?
A - true
Answer : A
Explaination
Yes! JavaScript is a case-sensitive language. This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
 Show Answer
Q 2 - Which of the following is the correct syntax to create a cookie using JavaScript?
A - document.cookie = 'key1 = value1; key2 = value2; expires = date';
B - browser.cookie = 'key1 = value1; key2 = value2; expires = date';
C - window.cookie = 'key1 = value1; key2 = value2; expires = date';
D - navigator.cookie = 'key1 = value1; key2 = value2; expires = date';
Answer : A
Explaination
document.cookie = 'key1 = value1; key2 = value2; expires = date'; is the correct option.
 Show Answer
Q 3 - Which built-in method returns the length of the string?
A - length()
B - size()
C - index()
D - None of the above.
Answer : A
Explaination
length() method returns the length of the string.
 Show Answer
Q 4 - Which of the following code creates an object?
A - var book = Object();
B - var book = new Object();
C - var book = new OBJECT();
D - var book = new Book();
Answer : B
Explaination
var book = new Object(); creates an object.
 Show Answer
Q 5 - Which of the following function of Number object returns a string value version of the current number in a format that may vary according to a browser's locale settings.?
A - toExponential()
B - toFixed()
C - toLocaleString()
D - toString()
Answer : C
Explaination
toLocaleString() − Returns a string value version of the current number in a format that may vary according to a browser's locale settings.
 Show Answer
Q 6 - Which of the following function of String object executes the search for a match between a regular expression and a specified string?
A - concat()
B - match()
C - replace()
D - search()
Answer : D
Explaination
search() − Executes the search for a match between a regular expression and a specified string.
 Hide Answer
Q 7 - Which of the following function of String object returns the calling string value converted to upper case while respecting the current locale?
A - toLocaleUpperCase()
B - toUpperCase()
C - toString()
D - substring()
Answer : A
Explaination
toLocaleUpperCase() − Returns the calling string value converted to upper case while respecting the current locale.
 Hide Answer
Q 8 - Which of the following function of String object causes a string to be displayed as a subscript, as if it were in a tag?
A - sup()
B - small()
C - strike()
D - sub()
Answer : D
Explaination
sub() − Causes a string to be displayed as a subscript, as if it were in a tag.
 Show Answer
Q 9 - Which of the following function of Array object returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found?
A - indexOf()
B - join()
C - lastIndexOf()
D - map()
Answer : A
Explaination
indexOf() − Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
 Hide Answer
Q 10 - Which of the following function of Array object removes the first element from an array and returns that element?
A - reverse()
B - shift()
C - slice()
D - some()
Answer : B
Explaination
shift() − Removes the first element from an array and returns that element.


No comments:

Post a Comment

Comment Here