Fill in the Blanks
3.1 Introduction
1. is an interpreted scripting language.
Ans.: JavaScript
2. is a set of instructions used to produce various kinds of outputs.
Ans. :Program
3. Theprograms in JavaScript language are called
Ans. : Scripts
4. is an object oriented scripting language and supports event ba
programming facility. (March 20
Ans.: JavaScript
5. ...isplatform independent scripting language.
Ans. :JavaScript
6. is knows as Universal client side scripting language.
Ans.: JavaScript
7. In scripting the scriptresides on the client computer.
Ans. :Client side
8. In scripting the script resides on web server.
Ans. :Server side
9. scripting does not need any server interaction.
Ans. : Client side
10. scripting communicates to theserver.
Ans. : Server side
11. scripts are used for validation purpose.
Ans. :Client side
12. scripts requires web browser as on interface.
Ans. :Client side
[Link] Technology (Science)
3-8 Advanced JavaScript
13. SCIipts requires web server software to
Serverside execute.
Ans. :
1S a
developed for single pageJavaScript
14. based open source frontend web framework
application.
Ans. : AngularJS
15. 1s JavaScript based framework for building interactive user
interface.
Ans. : VueJs
16. In JavaScript function is declared using
Ans. : function keyword.
17. consists of JavaScript libraries for building UI for single page
application and mobile application.
Ans. :React
3.2 Switch case and Looping
Structures
18. JavaScript has a built-in multiway decision statement known as
(March 2022)
Ans.: Switch
19. refers to the execution of statement or a group of statements Or
code for a fixed number of times.
Ans. :Iteration
20. loop combines initialization, condition and loop iteration in
single statement. (March:2022)
Ans. :For
21. means increment or decrement value of a running variable.
Ans. : Iteration
22. statement is used to jump out of loop. (March:2022)
Ans.: Break
23. When it is necessary to skip statement block and take the control at the beginning
for next iteration statement is used. (March 2022)
Ans.: Continue
3.3 Objects in JavaScript
24. The keyword is used to create new object in JavaScript.
(March 2022)
Ans. :new
25. An can group data together with functions needed to manipulate
it.
Ans.: Object
26. (March 2022)
All tangiblethings are known as
Ans. : Objects
3-9
TPS Information Technology (Science)
Advanced Javascih
27. DOM stands for
Ans. : Document Object Model (March 20
28. The way in which HTML document content is accessed and modified
Ans. : Document Object Model
cal ed ,
property of DOM object returns the <head>
29. element of the
document.
Ans. :Head (March 202
30. is an object based scripting language.
Ans.: JavaScript
31.
property of DOM object sets or returns title of the document
Ans.: Title
property of DOM object returns URL of the HTML
32.
Ans. : URL
method of DOM object writes HTML expressions or
,document.
33.
code to a document. JavaSc202ript
(March
Ans. :write)
34.
method of DOM object adds a newline character after.
statement.
Ans. : Writeln()
35. Using method id properly is used to find an element.
Ans. : getElementByld)
36. The property is useful for getting html elerment and changing it
Content. (March 202
Ans. :innerHTML
37. object is parent of all other objects.
Ans. :window
38. object represents an open window in a browser.
Ans.: window
39. property of window object sets or returns the name of the
window.
Ans. :Name
40. property of window object returns the location object for the
window.
Ans. : location
41. property of window object returns the document object for the
window.
Ans. :document
Status
42. property of window object sets or returns the fact in the
bar of a window.
Ans. :status
Information Technology (Science)
3-10
Advanced JavaScript
43. property of
whether a window has window object returns a Boolean valve
Ans.: closed
been closed or not. indicating
44. method
message with OK button
of window object display the alert box
containing
alert()
Ans.:
45. method of window object displays the confirm dialog box
containing message with ok and cancel button.
Ans. :confim)
46. method of window object displays a dialog box to get
user. input from he
(March 2022)
Ans. :prompt()
47. method ofwindow object opens the new window.
Ans. : open)
48. method of window object closes the current window.
Ans. : close)
49. method of window object removes focus from the current window.
Ans. : blur)
50. method of window object sets focus to the current window.
Ans. : focus)
51. method of window object prints the content of current window.
Ans. : print)
52.
method of window object calls a function or evaluates an expression
after a specified number of milliseconds.
Ans. :setTimeout)
3.4 JavaScript Events
application that occurs on the
53. are the actions done by users or an (March 2022)
webpage.
Ans. :Events
leaves field or looses focus of an
54. event handler occurs when user
element.
Ans. :onblur
element gets focus.
55. event handler occurs when an
Ans.: onfocus content of an element or selects
user changes
56. event handler occurs when (March 2022)
drop down list.
Ans.: onchange when user selects same text of an element
57. event handler occurs
Ans. :onselect
TPS Information Technology (Science)
3-11
Advanced lavai
button.
user clicks submit
58. event handler ocCurs when
Ans. :onsubmit when user clicks reset button.
event handler ocCurs
59.
Ans. :onreset
page/image has been loaded
60.
eventhandler occurs when
Ans. :onload document page has been
61.
closes
event handler occurs when
unloaded
Ans.: onunload
3.5 JavaScript built-in Objects
number.
62. object helpsus to work with
Ans. : Number property of Number object returns the largest minimum value
63.
(March 20)
Ans. : MIN VALUE
64.
property of number object returns the largest maximun
value. (March 202
Ans. :MAX_VALUE
number value.
65. property of Number object represents not a
Ans. : NaN
66. method of number object determines whether the given valueis
(March 202
a Integer.
Ans.: islnteger)
67.
method of number object converts the given string nto a
floating point number.
Ans. : parseFloat()
68.
method of Number object converts the given string into a
integer number.
Ans. : parselnt()
69. method of number object returns the string that represents a
umber with exact digits after a decimal point.
Ans. : isFixed() (March2022
70. object is used to store or manipulate text
Ans. : String
71. property of string object returns number of characters in a string
(March202
Ans.: Length specified
72. method of string object returns the character at the
position.
Ans. :charAt()
TecroiogT Sience) 3-12 Advanced JavaScript
method of string obiect returns the index of the first occurance
otspeifie
4nKinderOf)
character in givern string (March 2022)
method of string object returns the index of last OCCurance of
peafed character in given
lzstinderOf)
string
method of string object removes whitespace from both sides of a
string
Ams:trim)
method ot string object converts a string tolower Case. (March 2022)
As: toLOwerCase)
method of string object convert a string to upper
case.
AnS: tolpperCase)
The built in
object incdudes mathematical constants and functions.
Ans.: math
method of math object retums the absolute value of a number.
Ans: abs)
method of Math object returns the cube root of a number.
Ans. : cbrt)
$1 method of math obiect returns the next integer grater than or
equal to a given number.
Ans. :ceil0
method of math object retums the next integer less than or equal toa
gven number.
Ans. :floor)
3 method of math object returns the highest valued number in a list
of numberS.
Ans. : max)
method of math object returns the lowest valued number in a list of
mumbers.
Ans. : min)
...method of math object returns the base to the exponent power.
Ans.: pow)
method of math object returns a random number between 0
and 1.
Ans.: random)
method of math object returns the square root of a number.
Ans. :sqrt)
object is used to create date and time values.
Ans.: date
method of date object returns the day of the month.
Ans. : getDate)
method of date object returns the day of the week.
Ans. :getDay)
True or False
3.1 Introduction
1.1 JavaScript isan involved scripting language.
Ans. : False
2. An interpreted language is a type of programming language that executes its
instructions directly without compiling machine language.
Ans.: True
3. Program is aset of instructions used to produce various kinds of outputs.
Ans. :True
4. JavaScriptwas created to destroy web pages.
Ans. : False
5. There is no need of special software to run JavaScript program.
Ans.:True
TPS Information Technology (Science) 3-15
Advanced JavaScrit
6. Java script is an object oriented scripting language.
Ans. : True
JavaScript is not case sensitive language.
7.
Ans. : False (March 202
8. JavaScript helps the browser to perform inputvalidation.
Ans.: True
9. JavaScript cannot handle date and time.
Ans.: False
10. JavaScript has the ability to create new functions within scripts.
Ans. :True
11. Functions are declared in JavaScript using var keyword. (March 202)
Ans.: False
12. Software that can run on any hardware platform is called as platform independen
software.
Ans. : True'
13. JavaScript is platform independent scripting language.
Ans. :True
14. There are two types of scripting (March 2022
Ans. : True
15. In client side scripting, the script resides on client computer and that can run on the
client.
Ans. : True
16. Client side scripts are placed inside HTML document.
Ans. : True
17. In Server side scripting the scripts resides on web server.
Ans. : True
18. Server side scripting is used at the front end. (March 202
Ans. : False
19. Client side scripting is used at the front end.
Ans.: True
20. When a server side script is processed it communications to the client.
Ans. : False
21. Client side scripting does not need any server interaction.
Ans. : True
22. PHP, [Link] etc are server side scripting languages. (March202)
Ans.: True
23. Client side scripts are generally used for validation purpose.
Ans. : True
TPSInformation Technology (Science) Advanced JavaScript
3-16
3.2 Switch case and
Looping Structures
24 JavaScript has a built-in multiway decision statement known has switch.
Ans.: True
25.
There
should not be duplicitybetween the cases. (March 2022)
Ans. : True
The value for the case must be similar data type as the variable in switch.
26.
Ans.: True
27. Iteration reters to the execution of statements of code for a fixed number of times til
the condition is satisfied.
Ans.: True
28. For loop combines initializing, condition and loop iteration in single statement.
Ans. : True
n0 Loop willexecute statement in statements block will thecondition is false.
(March 2022)
Ans.: False
30. Iteration means increment or decrement value of a running variable. March 20L
Ans. : True
31. While loop executes statements as long as the condition is false.
Ans.: False
(March 2022)
32. Break statement is used to jump out of loop.
Ans.: True
33. Continue statement is used to makeearly exit from a loop.
Ans. : False
control at the
34. Continue statement is used to skip statement block and take the
beginning for next iteration.
Ans. : True
3.3 Objects in JavaScript
35. JavaScript is an object based scripting language.
Ans. : True
objects. (March 2022)
36. AJavaScript object is an entity having properties and
Ans.: True
accessed with Operator.
37. Properties and methods of object are
Ans. : True
38. JavaScript supports 4 types of objects.
Ans.: False
9 JavaScript gives facility to create user defined objects.
Ans.: True
3-1"
Technology (Sciene) JavaScript.
TPS Intormation
to create new object in
keyword is used
The new
40.
Ans. : True
Document Original Model. (Mar202
ch
DOM stands for
41.
Ans. :False content is accessedand modified is call ed
HTML document
42. The way in which
DOM. document
element of the
Ans. : True
object returns the <head>
43. Head property of DOM
document.
Ans. :True
object returns the name of the
Title propertyis DOM
44.
Ans. :False full URL of the HTML document.
object returns
45. URL property of DOM (March 202
Ans. : True
<body> elements respectively.
46. Body property of DOM object returns
Ans. : True
write Javascript code toa document.
47. write) method of DOM object
Ans. : True (March 2022
method of DOM object.
48. writeln() method is same as write ()
Ans. : False
new line character after each statement.
49. writeln() method of DOM object adds a
Ans. : True
any HTML element.
50. The outerHTML property is used to change
Ans. : False
(March 2022
51. window object is parent object of all other objects.
Ans. :True
52. An objectof window is created automatically by the browser.
Ans. : True
window.
53. name property of window object sets or returns the name ofa
Ans. : True
54. location property of window object returns a Boolean value indicating whether
window has been closed or not.
Ans. :False
55. document property of window object returns the document object for the window.
Ans. : True
56. status property of window object sets the name of a window. (March 2022
Ans. : False
57. alert) method of window object displays the alert box containing message wtn o
button.
Ans. : True
TPS
sInformation Technology (Science) Advanced JavaScript
3-18
prompt() method of window
58. : False
Ans. object displays a dialog box to set output for the user.
59. confirm() method of window object displavs the confirm dialog box cona
message with ok and cancel button.
Ans.: True
60.
open(); method of window object removes the focus from the current window.
(March 2022)
Ans.: False
61. close() nethod of window object closes the current window.
Ans. : True
62. blur() method of window object removes focus from the current window.
Ans.: True
63. focus() method of window object removes focus from the current windoW.
(March 2022)
Ans. : False
64. print() method of window object prints the content of current window.
Ans. : True
65. setTimeout()method of window obiect calls afunction after a specified number of
milliseconds.
Ans.: True
3.4 JavaScript Events
occurs on the web
66. Events are the actions done by the user or an application that (March 2022)
page.
Ans. : True
67. onKeyPress, onKeyDown are keyboard events.
Ans.: True (March 2022)
68. onClick, onMouseUp are mouse
events.
Ans.: True
element gets focus.
69. onblur event handler occurs when an
Ans. : False
element gets focus.
70. onfocus event handler occurs which an
Ans.: True
71. onchange event handler occurs when
user changes content of an element.
Ans. :True (March 2022)
handler occurs when page image has been loaded.
72. onselect event
Ans. : False
73. onsubmit event handler occurs when
user cickssubmit button.
Ans.: True
MCO (One Correct Answers)
3.1 Introduction
1. is an interpreted scripting language.
(a) PHP (b) C++ (c) HTML (d) JavaScript
Ans::(d)
2 is a set of instructions used to produce various kinds of outputs.
(a) Design (b) Software (c) Program (d) Hardware
Ans.: (c)
T PI
Sn t o r m a i
TPSInformation Technology (Science) 3-23 Advanced JavaScriph
interf
3. The programs in JavaScript language are caled
(a) Website (b) Scripts (c) Web server (d) Software (March 2022 15.
(a) V
A n s: .( a )
Ans. : (b)
and supports event
4. is an object oriented scripting language app
programming facility.
(d) Word
based 16.
(a)
(a) JavaScript (b) C++ (c) Excel
Ans.
: (d)
Ans. : (a)
5. isplatform independent scripting language.
(c) PHP (d) C++
(March 202 17.
Fun
(a)
(a) MSWord (b) JavaScript
Ans.: (a)
Ans. : (b)
6. is knows as Universal client side scripting language.
(a) Word (b) Powerpoint (c) Tally (d) JavaScript
Ans. : (d) Ja
7. In scripting the script resides on the client computer. 18.
(a) Client Side (b) Server Side (c) My Side (d) Website
Ans.:
Ans. : (a)
8. Ir ..... scripting the script resides on the web server. 19.
(a) Client side (b) My side (c) Server Side (d) Website
Ans. : (c)
9. scripting does not need any server interaction. Ans.
(a) Server Side (b) Website (c) My side (d) Client Side 20.
Ans. :(d)
10. scripting communicates tothe server.
(a) Client Side (b) Software Side Ans
(c) Server Side (d) Website 21.
Ans. : (c)
11. scripts areused for validation purpose. (March 2022) An
(a) Client Side (b) Server Side (c) Website (d) Web Browser 22.
Ans. : (a)
12. scripts requiresweb browser as on interface. A
(a) Server Side (b) Webpage (c) Website (d) Client Side 2
Ans. : (d)
13. scripts requires web server software to execute.
(a) Client Side (b) Server Side (c) Peer (d) Home
Ans. : (b)
14. is a JavaScript based open source frontend web framework
developed for single page application.
(a) Vue S (b) Responise (c) Angular JS (d) React
Ans. : (c)
Information
TPS Technology (Science)
3-24
is
15.
interface.
(a) Vue JS
JavaScript based framework for Advanced JavaScript
Ans.: (a)
(b)
Response (c) React building interactive user
(d) Uue JS
16
application and consists
mobile
of
JavaScript
(a) Angular }S (b) Vue .S application. libraries for building UI for single page
Ans. : (d) (c) Respond (d) React
Functions in
17.
(a) Function
JavaScript are declared using
(b) Object (c) Method Keyword.
Ans.:(a) (d) var
3.2 Switch case and Looping
18. JavaScript has a built-in multiway Structures
(a) Condition (b) Switch
decision statement known as
(c) Break (d) Continue (March 2022)
Ans. :(b)
19 refers to the execution of statement or a group of
code for a fixed number of times. staterments of
(March 2022)
(a) Statement (b) Function (c) Iteration (d) Method
Ans. : (c)
20. loop combines initialization, condition and loop iteration in
single statement.
(a) for (b) Break (c) Switch (d) Continue
Ans. :(a)
21. means increment or decrement value of a running variable.
(a) Switch (b) Method (c) Object (d) Iteration (March 2022)
Ans. : (d)
22, statement is used to jump out of loop. (March 2022)
(b) Continue (c) Break (d) React
(a) Respond
Ans. : (c)
23. What it is necessary toskip statement block and take the control at the beginning for
statement is used. (March 2022)
next iteration
(b) Continue (c) React (d) Response
(a) Break
Ans.: (b)
3.3 Objects in JavaScript
object in JavaScript.
24. The keyword isused to create new (d) New (March 2022)
(b) Wend (c) Loop
(a) Next
Ans.: (d)
Advanced Javabrri
327
box to get input
(Marchfron202)the
Technologv (Science) displays a dialog
TPS Information windowobject
method of (d) prompt()
45. (c) confirm)
user.
(b) open)
(a) alert()
Ans. : (d) window object
opensthe new window.
(d) blur()
(March 2022
method of (c) focus()
46. (b) close()
(a) open)
the current window.
object closes
Ans, : a)
methodof window (c) blur() (d) alert()
47. (b) close()
(a) open) windo.
focus from the current
objectremoves
method of window
Ans. : (b) (d) blur)
48.
(c) prompt)
(b) open(0
(a) print() current window.
focus to the
Ans. : (d)
method of window object sets (d) close()
49. (c) blur()
(a) focus) (b) open()
content of current window.
Ans. : (a)
method of window object prints the
50.
(b) setTimeout() (March 2022)
(a) alert)
(c) print) (d) open)
expression
Ans. : (d)
window object calls a function or evaluates an
method of
51.
of milliseconds.
after a specified number
(b) setTimeout)
(a) open()
(c) blur) (d) focus()
Ans. : (b)
3.4 JavaScript Events
are the actions done by users or an application that occurs on the
52.
webpage. (d) Functions
(a) Events (b) Methods (c) Object
Ans. : (a)
53. event occurs when user leaves or looses focus of an element.
(March 2022)
(a) onchange (b) onblur (c) onfocus (d) onload
Ans. : (b)
54. event occurs when an elemnent gets focus
(a) onload (b) onblur (c) onfocus (d) onchange
Ans. : (c)
hlormation
Technology (Science)
S 3-28
event OCCUrs when Advanced JavaScript
down value. user
(a) onblur (b) onfocus
changes content of an element or selects drop
(c) onloád
(d) onchange
event OCCurs When user
(a) onselect (b) onblur selects some text of an
(c) onchange element (March 2022)
Ans.
: la) (d) onsubmit
event oCCUrs hen user
(a) onblur clicks submit button.
(b) onchange (c) onfocus
(d) onsubmit
event OCCurs when user
clicks reset button (March 2022)
la) onload (b) onreset
(c) onchange (d) onsubmit
Ans.: (d)
eventoccurs when page/image has been
(a) onblur (b) onsubmit (c) onload loaded.
(d) onunload
Ans.: (c)
eventoccurs when document page has been unloaded or
closes.
(a) onsubmit (b) onunload (c) onselect (d) onload (March 2022)
Ans.: (b)
3.5 JavaScript built-in Objects
61 object helps us towork with number.
(a) Math (b) Number (c) Array (d) Date
Ans. :(b)
62 property of Number object returns the largest minimum value.
(a) MAXVALUE (b) NaN
(d) Fixed (March 2022)
(c) MIN_VALUE
Ans.: (c)
value.
63 property of number object represents not a number
(d) Index (March 2022)
(a) NaN (b) Value (c) Fixed
Ans.: (a)
whether the given value is a
Method of Number object determines
integer. (c) islnteger() (d) parselnt)
l4) parseFloat() (b) isFixed)
Ans.: (c) whether the given value is
number object determines
method of (March 2022)
Int(a)[Link]() (b) parselnt() (c) isFixed() (d) NaN
Ans.: (a)
MCQ (Two Correct Answers)
3.1 Introduction
1. Features of JavaScript are (March 20m
(a) It needs special software
(b) JavaScript is light weight scripting language
(c) Cannot create new function
(d) It is object oriented scripting
Ans.: (b),(d)
nformation Technology (Science)
3-34 Advanced JavaScript
There are two types of Scripting
2 (a) Server side (b) My side
(c) Browser side (d) Client
(d) side
: (a),
Ans.
[Link] Scripting
(a) These scripts are paced inside
HTML document
(b) In this type the script resides on Client
In this type, the script resides on Computer.
web server
) To execute scIipt it must be
Server.
activated by client then it is executed on weu
(b)
Ans.: (a),
3.2 Switch case and Looping
Structures
4. Types of loops in JavaScript are (March 2022)
(a) for ...loop (b) while.....oop
(c) for ....next (d) while ....wend
Ans. : (a), (b)
5 Correct mnethod of for loop are
(a) for (i =1; i<=5; i++) (b) for (i =1, i! =4);
document. write(i); [Link] (i);
(c) for (i =1;i<=5; i+ +) (d) {i-1,ic =5, i++)
{
[Link](i); [Link] (i),
Ans. : (a), (c)
3.3 Objects in JavaScript
6. JavaScript supports following types of objects
(a) Variables b) built-in objects
(c) User defined objects (d) loops
Ans. : (b), (c)
7. Following are the built in objects in JavaScript
(b) Time (c) Array (d) Month
(a) Math
Ans. : (a), (c)
TPSIntormation Technology (S ience) 3-35
Advared )avdny
8. Following are the properties of DocumentObject Model
(a) Sre (b) head (c) URL (d) title
Ans. :(a), (c)
9 Following are the nethods of Document Object Model
(a) body (b) write() (c) URIL (d) writeln()
Ans. :(b), (d)
10. Following are the properties of Window object
(a) name (b) location (c) alert() (d) confirn)
March 212
Ans. : (a), (b)
11. Following are the methods of Window object
(a) open() (b) status (c) closed (d) closel)
Ans. : (a), (d)
12. confirm() method of window object displays confirm dialog box containing messaue
with...........nd.......... button.
(a) GO (b) OK (c) Cancel (d) Click
(March 2022
Ans. :(b), (c)
3.4 JavaScript Events
13. Following are the. event handlers in JavaScript
(a) onsubmit (b) write() (c) onchange (d) writeln()
Ans. :(a), (c)
3.5 JavaScript built-in Objects
14.
In JavaScript following methods of String object returns the characters you
specified.
(a) substring() (b) indexOf() (c) substr() (d) lastlndexOf)
Ans. :(a), (c)
15. Following properties of Number Object returns the largest minimum and maximum
value
(a) MIN_VALUE (b) MAX_VALUE
(c) toLowerCase() (d) toUpperCase)
Ans. :(a), (b)
16. Following are the properties of Number Object in Javascript (March 2022)
(a) lowercase (b) Uppercase (c) NaN (d) MAX _VALUE
Ans. :(c), (d)
17. Following are the methods of Number of object in JavaScript
(a) NaN (b) parselnt() (c) isFixed() (d) toLowercase()
Ans. :(b), (c)