JavaScript Quiz with answers – Part 3

Practical questions to test your knowledge of JavaScript programming – Part 3

How to declare an array "tab" of 10 elements?
tab = new Array(10)
var tab[10]
var tab = array(10)
var tab(10)

Correct!

Wrong!

What is the code to get a random number between 5 and 9 inclusive?
Math.floor ( ( Math . random ( ) * 5 ) + 4 ) ;
Math.floor ( ( Math.random ( ) * 4 ) + 4 ) ;
Math.floor ( ( Math.random ( ) * 5 ) + 5 ) ;
Math.floor ( ( Math.random ( ) * 4 ) + 5 ) ;

Correct!

Wrong!

To check if three variables are equal, we will use _____?
X = Y = Z
( X == B ) & & ( Y == Z )
( X = B ) && ( Y = Z )
( X == B ) & ( Y == Z )

Correct!

Wrong!

How many parameters can be passed to a function?
None
As much as you want
One for each argument

Correct!

Wrong!

Which of these parameters is not valid?
text
a variable
an operator
a number

Correct!

Wrong!

How can you detect the name of the client's browser?
navigator.appName
browser.name
client.navName
window.appName

Correct!

Wrong!

If str = "VWXYZ", what does str.charAt(3) return?
X
Y
Z
false

Correct!

Wrong!

The following statement A? B: C is equivalent to ______?
if (A) {B; C}
if (A != B) C
if (A == B) C
if (A) {B} else {C} Réponse

Correct!

Wrong!

Which one is not a comparison operator?
<
>
=
!=

Correct!

Wrong!

What event is specific to the keyboard?
onkeypress
onkeydown
onclick
onfocus

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

JavaScript Quiz – Part 3

I got %%score%% of %%total%% right

%%description%%

%%description%%

Loading...

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *