Search Header Logo

JavaScript Quiz

Authored by uthira C

Design

10th Grade

Used 11+ times

JavaScript Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to include an external JavaScript file in HTML?

<script src="app.js"></script>

<script href="app.js"></script>

<link src="app.js"></link>

<style src="app.js"></style>

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to declare a variable in JavaScript?

var x = 10;

variable x = 10;

x := 10;

let 10 = x;

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the result of the following code be? let a = 10 + "5";

15

105

50

Undefined

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to assign a value to a variable?

==

===

=

=>

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? let age = 18; if (age >= 18) { console.log("You are an adult."); } else { console.log("You are a minor."); }

"You are a minor."

"You are an adult."

Error

Undefined

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the result of this code be? let num = 7; if (num % 2 === 0) { console.log("Even number"); } else { console.log("Odd number"); }

Even number

Odd number

Undefined

Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to define a function in JavaScript?

function myFunction() { }

def myFunction() { }

func myFunction() { }

create function myFunction() { }