JavaScript
question_1
In JavaScript, how do you round the number 7.25 to the nearest integer?
a) round(7.25)
b) Math.round(7.25)
c) Math.rnd(7.25)
d) rnd(7.25)
Question 2:
In JavaScript, what is the correct way to write the string 'Hello world' on a page?
web?
document.print("Hello world")
document.write("Hello world")
window.print("Hello world")
window.write('Hello world')
Question 3:
In JavaScript, what does the break statement do?
a) Finalizes the execution of the current method
b) Finish the execution of the code
c) Skip to the next iteration in the current for, while, or do-while loop
d) Ends the execution of the current for, while, or do-while loop
Question 4:
In JavaScript, how do you open a new browser window?
document.open("page.html")
b) document.new("page.html")
window.open("pagina.html")
window.new("page.html")
Question 5:
In the DOM, to get the CSS class applied to an element, the is used.
property
a) css
b) class
c) class name
d) style
Question 6:
In an XHTML page, what is the correct way to reference an external file?
with a JavaScript file called "xxx.js"?
<script name="xxx.js" type="text/javascript" />
<script src="xxx.js" type="text/javascript"></script>
c) <script src="xxx.js" type="text/javascript" />
d) The previous answers are not correct
Question 7:
In JavaScript, how do you write a conditional statement to check that
Is the variable 'i' different from 5?
a) if(i != 5)
b) if(i != 5)
c) if i is not equal to 5
d) if i != 5
Question 8:
In JavaScript, how do you insert a comment that occupies one line?
a) <!-- Comment -->
// Comment
c) ' Comment
d) The previous answers are not correct
Question 9:
In JavaScript, the operator to concatenate strings is
d) The previous answers are not correct
Question 10:
JavaScript is a programming language
a) Compiled
b) Interpreted
c) Unstructured
d) The previous answers are not correct.
Question 11:
Does an external file with JavaScript code need to contain the <script> tag?
a) Yes
b) No
Pregunta 12
In JavaScript, what is the name of the method that checks a regular expression and returns
true if it is fulfilled?
a) check()
b) exec()
c) run()
d) test()
Question 13:
In JavaScript, to terminate a 'for' loop, it is used
a) It cannot be
b) Exit for
c) break
d) The previous answers are not correct
Question 14:
In JavaScript, what function is used to split a string based on
a separator?
a) match()
b) replace()
c) slice()
d) split()
Question 15:
In the DOM, to obtain the textual content of a part of the page, the is used.
property
a) content
b) text
c) textContent
value
Pregunta 16
According to the DOM, everything on a web page is
an attribute
b) A node
c) A table
d) The previous answers are not correct
Pregunta 17
In JavaScript, to obtain a specific character from a string based on its position, you
use the function
a) char()
b) charAt()
c) value()
d) The previous answers are not correct
Question 18:
Regarding JavaScript and Java, it can be said that
a) JavaScript is the interpreted version of Java
b) JavaScript is a subset of Java
c) JavaScript is a branch that originated from Java
d) The previous answers are not correct
Pregunta 19
Which HTML tag is used to write JavaScript code?
a) <script>
<javascript>
c) <scripting>
d) <js>
Question 20:
In the DOM, the method used to remove a child element is
a) deleteChild()
b) dropChild()
c) removeChild()
d) The previous answers are not correct.
Question 21:
In JavaScript, string literals (constants) are written
a) As sequences of characters enclosed in single quotes
b) As sequences of characters enclosed in single or double quotes
c) As sequences of characters enclosed in braces
d) Like sequences of characters enclosed in brackets
Question 22:
What is JSON?
a) An object-oriented programming language based on JavaScript
b) A server-side application based on JavaScript
c) A lightweight format for data interchange used in JavaScript
d) The previous answers are not correct
Question 23:
In JavaScript, how is a random number generated?
a) Math.random()
b) Math.round()
Math.random()
d) The previous answers are not correct
Pregunta 24
DOM is the acronym for
Document Object Markup
Document Of Model
c) Domain Object Model
d) The previous answers are not correct
Question 25:
The DOM is standardized by
Apple, Microsoft and Mozilla
b) ECMA
c) ISO
d) W3C
Question 26:
In JavaScript, how is a function called 'myFunction' defined?
a) function:myFunction()
b) function->myFunction()
c) function myFunction()
d) The previous answers are not correct
Pregunta 27
In JavaScript, how do you insert a comment that takes up a line?
a) # Comment
b) // Comment
c) ' Comment
d) The previous answers are not correct.
Question 28:
In JavaScript, how do you open a new browser window?
window.blank("pagina.html", "new")
b) window.new("page.html", "new")
c) window.create("page.html", "new")
d) The previous answers are not correct
Question 29:
In JavaScript, what is the correct way to create an array?
a) var txt = new Array:1=("tim"),2=("kim"),3=("jim")
Invalid syntax for array initialization.
c) var txt = new Array("tim","kim","jim")
d) var txt = new Array(1:"tim", 2:"kim", 3:"jim")
Question 30:
In JavaScript, how do you write a 'for' loop to count from 1 to 5?
a) for(i = 1; i <= 5; i++)
b) for(i <= 5; i++)
c) for i = 1 to 5
d) The previous answers are not correct
Question 32:
In JavaScript, what does the continue statement do?
a) Finalizes the execution of the current method
b) Finalizes the execution of the code
c) Jump to the next iteration in the current for, while, or do-while loop
d) Ends the execution of the current for, while, or do-while loop
Question 33:
Regarding web browsers, the BOM is the
a) Byte Object Model
b) Browser Object Model
c) Binary Object Model
d) The previous answers are not correct
Question 34:
In JavaScript, what is the function called 'myFunction'?
a) call function myFunction()
b) call myFunction()
c) myFunction()
d) The previous answers are incorrect
Question 35:
Where can JavaScript code be inserted in an HTML document?
a) In the <head>
b) In the <body>
c) Both in the <head> and in the <body>
d) If the code is in a separate file, only in the <head>
Question 36:
In JavaScript, how do you put a message in the browser's status bar?
window.status('the message')
navigator.status("the message")
window.status = "the message"
navigator.status = "the message"
Question 37:
Identify the function of the HTML tag <noscript>
a) The <noscript> tag is used to define content that summarizes the
functionality of a script: this content is only displayed if the browser does not support
scripting
b) The <noscript> tag disables the ability to execute a script in the browser.
c) The <noscript> tag can be used by designers to indicate that a
web page uses scripting: if <noscript> is used, the browser will process the web page
more efficiently
d) All answers are correct
Question 38:
In a web browser, to write something in the console, you use
a) console.append()
b) console.log()
c) console.print()
d) console.write()
Question 39:
In JavaScript, what function is used to convert a string to lowercase?
a) lower()
b) lowerCase()
c) toLower()
toLowerCase()
Question 40:
In JavaScript, how do you calculate the maximum of the numbers 2 and 4?
ceil(2, 4)
top(2, 4)
c) Math.ceil(2, 4)
d) Math.max(2, 4)
Question 41:
In JavaScript, the positions of the characters in a string start at
-1
b) 0
c) 1
d) The previous answers are not correct
Question 42:
Regarding the end of instruction in JavaScript
a) The semicolon (;) is used and is mandatory
b) The semicolon (;) is used, but it is optional.
c) No delimiter is used
d) The previous answers are not correct
Question 43:
In the DOM, to visit the next sibling node, one uses
brother
b) next
c) nextBrother
d) The previous answers are not correct
Question 44:
In JavaScript, what is the name of the method that checks a regular expression and returns
the chain that fulfills it?
a) check()
b) exec()
c) run()
d) test()
Question 46:
In JavaScript, how do you obtain the browser version?
a) browser.appVersion
b) browser.version
c) navigator.appVersion
d) navigator.version
Question 47:
In JavaScript, how can one navigate to the previous page in the browsing history?
a) navigator.go(-1)
b) document.url.prev()
c) url.return()
history.back()
Question 48:
In JavaScript, to access a cookie, you use
a) document.arrayCookie
b) document.cookie
c) document.getCookie()
d) The previous answers are not correct.
Pregunta 49
What function exists in the DOM?
getElementsById()
b) getElementByName()
c) getElementsByTagName()
d) The previous answers are not correct
Question 50:
The DOM represents a web page as
a tree
b) A list
c) A hash table
d) The previous answers are not correct.
Question 51:
In JavaScript, to get the length of the string 'cad', you use
a) strlen(cad)
b) len(cad)
c) cad.length
d) The previous answers are not correct.
Question 52:
In JavaScript, how do you display a window with the message 'Hello world!'?
alert('Hello world!');
Hello world!
alertBox("Hello world!");
d) msgBox("Hello world!");
Question 53:
In JavaScript, how do you write a conditional statement to check that
Is the variable 'i' equal to 5?
a) if i=5 then
b) if(i=5)
c) if i==5 then
d) if(i==5)
Pregunta 54
In the DOM, to add a child element, the method is used
a) appendChild()
createChild()
c) newChild()
d) The previous answers are not correct
Question 56:
Which of the following statements about arrays in JavaScript is false?
a) The elements can be of different types
b) Multidimensional arrays cannot be created.
c) The index can be a string or an integer
d) Brackets are used to indicate the positions in the array.
Question 57:
In JavaScript, what is the name of the object that represents a regular expression?
There is no object
b) ExpReg
c) RegExp
d) Rexp
Question 58:
In JavaScript, the operator to concatenate strings is
&
d) The previous answers are not correct
Question 59:
In the DOM, the type of a node is obtained with the property
a) elementType
b) nodeType
c) type
d) The previous answers are not correct
Question 61:
In JavaScript, regarding variable declaration
a) You should always declare the variables
b) You can force the declaration with Option Implicit
c) They are declared with the reserved word Dim
d) The previous answers are not correct