WorksheetsJavaScript quiz for beginners
Total questions: 10
Worksheet time: 3mins
Inside which HTML element do we put the JavaScript?
<scripting>
<js>
<javascript>
<script>
What is the correct JavaScript syntax to change the content of the HTML element below?
<p id="geek">GeeksforGeeks</p>
document.getElement(“geek”).innerHTML=”I am a Geek”;
document.getElementById(“geek”).innerHTML=”I am a Geek”;
document.getId(“geek”)=”I am a Geek”;
document.getElementById(“geek”).innerHTML=I am a Geek;
Which of the following is the correct syntax to display “GeeksforGeeks” in an alert box using JavaScript?
alertbox(“GeeksforGeeks”);
msg(“GeeksforGeeks”);
msgbox(“GeeksforGeeks”);
alert(“GeeksforGeeks”);
What is the correct syntax for referring to an external script called “geek.js”?
<script src=”geek.js”>
<script href=”geek.js”>
<script ref=”geek.js”>
<script name=”geek.js”>
The external JavaScript file must contain <script> tag. True or False?
True
False
Predict the output of the following JavaScript code.
16
Compilation Error
88
Run time Error
Witch intruction from this create an Loop?
if
while
var
else
This date 29 is data type?
Boolean
String
Integer
Float
What is the correct syntax for declaring a function?
var myFunction()
myFunction function()
function myFunction()
function my Function()
Which is the correct syntax for displaying data in the console?
console.log();
log.console();
console.log[];
console.log;
