Site icon i2tutorials

JavaScript-Quiz-1

This Quiz contains totally 10 Questions each carry 1 point for you.

1. Javascript is an _______ language?
Object-Oriented
Object-Based
Procedural
None of the above

Correct!

Wrong!

2. Which of the following keywords is used to define a variable in Javascript?
var
let
Both 1 & 2
None of these

Correct!

Wrong!

3. Which of the following methods is used to access HTML elements using Javascript?
getElementbyId()
getElementsByClassName()
Both A and B
None of the above

Correct!

Wrong!

4. Upon encountering empty statements, what does the Javascript Interpreter do?
Throws an error
Ignores the statements
Gives a warning
None of the above

Correct!

Wrong!

5. Which of the following methods can be used to display data in some form using Javascript?
document.write()
console.log()
window.alert()
All of the above

Correct!

Wrong!

6. How can a datatype be declared to be a constant type?
const
constant
var
let

Correct!

Wrong!

7. What will be the output of the following code snippet?

<script type="text/javascript">
a = 5 + "9";
document.write(a);
</script>


Compilation Error
Runtime Error
14
59

Correct!

Wrong!

8. What will be the output of the following code snippet?

<script type="text/javascript" language="javascript">

var a = "Scaler";
var result = a.substring(2, 4);
document.write(result);

</script>


al
ale
cal
caler

Correct!

Wrong!

9. What will be the output of the following code snippet?

<script type="text/javascript" language="javascript">

var x=12;
var y=8;
var res=eval("x+y");
document.write(res);

</script>







20






x+y






128






None of the above



20
128
x+y
None of these

Correct!

Wrong!

10. When the switch statement matches the expression with the given labels, how is the comparison done?








Only the datatype of the expression is compared.






Only the value of the expression is compared.






None of the above.




Both the datatype and the result of the expression are compared.
Only the datatype of the expression is compared.
Only the value of the expression is compared.
none of these

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Ignore & go to results

JavaScript-Quiz-1

You got %%score%% of %%total%% right

%%description%%

%%description%%

Where to go ?

Quizzes

Loading...

Exit mobile version