wayground logo

Lembar Kerja Gratis yang Dapat Dicetak

Ukuran huruf

S
M
L
XL
Lembar kerja

JS INTRO

Total soal: 90

Worksheet time: 58mins

Nama
Kelas
Tanggal
1.

JS can change HTML?

a)

False

b)

True

2.

Which of the following are applications of JS?

a)

Client Side

b)

Absolute

c)

None of the above

3.

How Can we write variables in Js?

a)

The Text is shown normal.

b)

var x= 6;

c)

None of the above

4.

Where to put JS Scripts Tags ?

a)

The Text is shown normal.

b)

<head> or <body>

c)

None of the above

5.

Which is Single Line Comments ?

a)

The Text is shown normal

b)

<!--None of the above--<

c)

// the text

6.

Javascript can only be run on a browser.

a)

True

b)

False

7.

Predict the output for the piece of code:


<html>

<body>


<script language="JavaScript">

function Test(){

document.write("Hello World!");

}

</script>


<input type="submit" value="click here" onclick="Test()"/>


</body>

</html>

a)

Error

b)

Displays Hello World! Along with clickhere button

c)

Displays Hello World! after clicking on clickhere button

d)

Displays nothing

8.
JavaScript uses the + operator for both addition and concatenation.
a)
true
b)
false
9.
Which of the below keywords is used to define a function in JavaScript?
a)
fun
b)
function
c)
Function
d)
None of the above
10.

Predict the output:


<p id="test"></p>

<script>

var date = 10;

month = "July";

var year = 2020;


document.getElementById("test").innerHTML =

date + "<br>" + month + "<br>" + year

</script>

a)

No output

b)

44022

c)

10

July

2020

d)

10

2020

11.

Predict the output:


<!DOCTYPE html>

<html>

<body>


<p id="test"></p>


<script>

function firstFunction(p1, p2) {

return p1 + p2;

}

document.getElementById("test").innerHTML = firstFunction(1, 5);

</script>


</body>

</html>

a)

6

b)

No output

c)

Error while declaring the function

d)

None of the above

12.

Which of the following is wrong?

a)

var greeting = `\`Yo\` World!`;


//output - `Yo` World!

b)

var user = {name: 'World'};

console.log(`Thanks for getting this into V8, ${user.name.toUpperCase()}.`);


//output - Thanks for getting this into V8, WORLD.

c)

console.log("string text line 1 \ string text line 2");


//output - string text line 1
string text line 2

13.

I want to extract 'hello' and 'array' from the array using destructuring

a)

 var [greeting,name] = ["Hello", "I" , "am", "Array"]; 

b)

 var [greeting,,,name] = ["Hello", "I" , "am", "Array"];

c)

 var array = ["Hello", "I" , "am", "Array"]; 

greeting = array[0];

name = array[2];

14.

Select all the correct options.

a)

var[greeting = "hi", name = “Array"] = ["hello"];

b)

let person = {name: "Object", country: "India", job: "Developer"};

let {name = "Name", company = "Epsilon"} = person;

c)

const message = `Some weird characters: \${abc}`;

d)

var a = 10;

var b = 5;

var result = `The sum of ${a} and ${b} is ${a + b} difference is ${a-b}`;

15.

[a, b, ...rest] = [10, 20, 30, 40, 50];

console.log(rest);

a)

50

b)

[30, 40, 50]

c)

[10, 20]

16.

let a, b;

[a=5, b=7] = [1];

console.log(a);

console.log(b)

a)

1 7

b)

5 7

c)

1 1

d)

5 1

17.

let a = 1;

let b = 3;

[a, b] = [b, a];

console.log(a);

a)

1

b)

3

18.

const arr = [1,2,3];

[arr[2], arr[1]] = [arr[1], arr[2]];

console.log(arr);

a)

[3,1,2]

b)

[1,3,2]

c)

[1,2,3]

19.

const o = {p: 42, q: true};

const {p: foo, q: bar} = o;

console.log(foo);

a)

undefined

b)

42

c)

p

d)

foo

20.

How would we print to JS console?

a)

console.print()

b)

console.log()

c)

console.log();

d)

console.pring();

21.

How would we use JS to get the number 4 using Arithmetic operators?


You can select more than 1

a)

console.log(2 - 2);

b)

console.log(6 - 2);

c)

console.log(2 * 2);

d)

console.log(2 / 2);

22.

What is the correct way to use a method to print hello to your console?


console (a)   ("Hello World!");

23.

What are the three types of var in JS 6?

a)

var

b)

get

c)

let

d)

POST

e)

const

24.

The simplest data-storing structure in any programming language

a)

Lists

b)

Array

c)

Queue

d)

List

25.

Local Browser used for validations on the Web Pages uses __________.

a)

HTML

b)

CSS

c)

js

d)

java

26.

When we are done with a line what do we put at the end?

a)

a colon :

b)

a semi-colon ;

c)

a period .

d)

a quotation mark "

27.

Which of the following will decrease the value of x?

a)

x--;

b)

x-1;

c)

x=x;

d)

x=-x;

28.

Which of these will increase the value of the variable X?

a)

increment (x)

b)

x++;

c)

x=x;

d)

x+1;

29.
What surrounds a string?
a)
Quotations
b)
Curly Brackets
c)
Parenthesis
d)
Square Brackets
30.
A string;
a)
Expresses a true false statement
b)
can contain letters, numbers, spaces, and symbols.
c)
takes in an input, does something with it, and then returns an output.
d)
Runs a boolean (true/false) statement based on data entered
31.
A programming language used to make websites interactive.
a)
Css
b)
Jquery
c)
Html
d)
JavaScript
32.
Using JavaScript to select elements, attributes, or text from an HTML page.
a)
Programming Concepts
b)
Modify Content
c)
Javascript Vocabulary
d)
Access Content
33.
A software used to write and edit code.
a)
Solution Explorer
b)
Code Editor
c)
Form Designer
d)
Html
34.
A style sheet language used for web page design.
a)
HTML
b)
JAVASCRIPT
c)
CSS
d)
JQUERY
35.
The necessary equipment to use JavaScript.
a)
Computer with Web Browser
b)
Modify Content
c)
Filtering Data
d)
Javascript
36.

Javascript is _________ language.

a)

Programming

b)

Scripting

c)

Application

d)

applet

37.

JavaScript is ______ Side Scripting Language.

a)

JSP

b)

Servlet

c)

Server

d)

Browser

38.

JavaScript is designed for following purpose -

a)

To Style HTML Pages

b)

To Perform Server Side Scripting Opertion

c)

To add interactivity to HTML Pages.

d)

To Execute Query Related to DB on Server

39.

JavaScript is can be written -

a)

directly into JS file and included into HTML

b)

directly into HTML pages

c)

directly on the Server Script

d)

None of these

40.

JavaScript is an ________ language.

a)

compiled

b)

interpreted

41.

JavaScript Code is written inside file having extension __________.

a)

.jsc

b)

.jvs

c)

.js

d)

.javascript

42.

Why JavaScript is called as Lightweight Programming Language ?

a)

because JS can provide programming functionality inside but up to certain extend.

b)

because JS is client side scripting

c)

because JS is available free of cost.

d)

because we can add programming functionality inside JS

43.

Local Browser used for validations on the Web Pages uses __________.

a)

HTML

b)

CSS

c)

js

d)

java

44.

Is this correct syntax to include JS Code inside HTML Page ?

<script type="text/javascript">

...

</script>

a)

Yes

b)

No

45.

We cannot Place JS Code in the body tag . Say true/false.

a)

True

b)

False.

46.
Indicates the beginning  and the end of a JavaScript section.
a)
<html> </html>
b)
<style> </style>
c)
<article> </article>
d)
<script> </script>
47.
A JavaScript file has an extension name of
a)
.jscp
b)
.js
c)
.css
d)
.Jp
48.
Which keyword do we need to define a function?
a)
function
b)
method
c)
onclick
d)
functionName()
49.
Which 1 of the following symbols is used for JavaScript comments?
a)
\\
b)
^
c)
?
d)
//
50.
What type of variable is
var typeOfApples="Fuji";
a)
Int
b)
Float
c)
Boolean
d)
String
51.

How can a developer show a pop-up message to the user?

a)

alert

b)

prompt

c)

console.log

d)

<p> tag

52.
Which message will the user see?
a)
"Hello user"
b)
No message
c)
"Goodbye user"
d)
"message + user"
53.

What attribute/value do we use to make a button execute JavaScript when clicked?

a)

onclick="doSomething;"

b)

on-click="doSomething;"

c)

onclick="doSomething();"

d)

onclick=doSomething();

54.
How do I declare a new variable?
a)
var newVariable = 5;
b)
Variable int = new Variable();
c)
var 5 = myVariable;
d)
int var = 5;
55.
What is CSS used for?
a)
styling web pages
b)
formatting script correctly
c)
client side scripting
d)
server side scripting
56.
How do we generate a random number?
a)
Math.random()
b)
random.number()
c)
number.random()
d)
Random.math()
57.

Which of the following platform(s) can be used to run Javascript Code

a)

Google Chrome

b)

Firefox

c)

Microsoft Edge

d)

Safari

58.
How do I change the size of an image?
a)
width / height
b)
scale
c)
size
d)
shrink
59.

What is the correct syntax for referring to an external JavaScript script?

a)

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

b)

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

c)

<js href="myscript.js"></js>

d)

<js src="myscript.js"></js>

60.
Which attribute(s) of the FORM and INPUT tags become the properties of the created object?
a)
value
b)
value and name
c)
name
d)
name and type
61.

Which of the following statements distinguishes a programming language from a scripting language?

a)

Programming languages are object-based, whereas scripting languages are object-oriented

b)

Programming languages are developed by private organizations, whereas scripting languages are open-source

c)

Programming languages are compiled, whereas scripting languages are interpreted

d)

Programming languages are subsets of scripting languages and are interpreted

62.

Which of the following technologies enables server-side scripting using Java Script

a)

React

b)

Java

c)

Node JS

d)

C++

63.

Which of the following is not a feature for Java Script

a)

Case-sensitive

b)

Compiled Language

c)

Object-Oriented

d)

Platform Independent

64.

Why should comments be included within JavaScript code blocks?

a)

Because comments are required for each Java Script code block

b)

Because comments deactivate all JavaScript code during debugging

c)

Because comments provide accessibility in browsers for the visually impaired.

d)

Because comments provide a way to indicate the intent of the code

65.

 

Java Script is defined under which category of languages?

a)

Object-Oriented (Prototype-based)

b)

Object-Driven

c)

Object- Independent

d)

Object-Oriented (Class-based)

66.

Which of the following BEST describes an Object-Oriented program?

a)

A network of objects logically connected to one another that perform a series of tasks.

b)

A sequence of statements that collectively performs an specific task

c)

A collection of individual objects that perform different functions

d)

A collection of objects that perform specific functions in a sequential order

67.

Which of the following is used to add multiline comments in JS?

a)

::

b)

<!-->

c)

//

d)

/* */

68.

Which of the following terms identifies the attributes that define the characteristic of an object?

a)

Property

b)

Method

c)

Value

d)

Function

69.

Which of the following terms can perform an action by an object?

a)

Value

b)

Object

c)

Method

d)

Property

70.

Which of the following terms specifies the quality of a property?

a)

Value

b)

Property

c)

Object

d)

Prototype

71.

Which of the following is not a number data type in JavaScript?

a)

-50

b)

20.04

c)

-1292.38101

d)

"123"

72.

How do comments look like in JavaScript?

a)

//

b)

@@

c)

&&

d)

**

73.

Can you change the value of a const?

a)

Yes

b)

No

74.

How many options can a boolean variable have?

a)

1

b)

2

c)

3

d)

4

75.

Can variables change their type in JavaScript?

a)

Yes

b)

No

76.

Which of the following is an invalid string?

a)

"Hello"

b)

`Hello`

c)

"Hello'

d)

'Hello'

77.

What is the index of the letter G in 'VIBGYOR'?

a)

1

b)

2

c)

3

d)

4

78.

Which string method makes text uppercase in JavaScript?

a)

.toUpperCase()

b)

.TOUPPERCASE()

c)

.UpperCase()

d)

.ToUpperCase()

79.

What does the string method .trim() do?

a)

Removes all text

b)

Removes all whitespace

c)

Removes a specific part of the text

d)

Replaces whitespaces

80.

What is the output of "Hello".indexOf('l')

a)

3

b)

4

c)

-1

d)

2

81.

Maximum number of arguments String.slice() method can take in JS?

a)

3

b)

2

c)

1

d)

0

82.

Select the output for 100 + "Hello"

a)

"100Hello"

b)

Error

c)

"100 Hello"

d)

"100+Hello"

83.

Select the output for Hello World + 100

a)

Error

b)

"Hello World100"

c)

"Hello World 100"

d)

"HelloWorld100"

84.

Which of the following is a template literal string?

a)

`Hello`

b)

"Hello"

c)

'Hello'

d)

"${Hello}"

85.

What is the output for: `You bought ${qty} apples` if qty = 5?

a)

"You bought ${qty} apples"

b)

"You bought 5 apples"

c)

Error

d)

"You bought apples"

86.

What is a null variable?

a)

Unknown variable

b)

Variable assigned a value of null

c)

Variable without a name

d)

Variable without a data type

87.

What is an undefined variable?

a)

Variable without a value

b)

Variable assigned a value of null

c)

Variable without a name

d)

Variable without a data type

88.

What is the value of Math.pow(4,6)?

a)

1024

b)

2048

c)

4096

d)

24

89.

Which of the following is a Math.random() output?

a)

0.6625590695007806

b)

1

c)

1.5590695007806

d)

All of the above

90.

What is the output of parseInt('Carat 24 Diamond')?

a)

24

b)

"Carat 24 Diamond"

c)

"24"

d)

NaN