Ukuran huruf
Lembar kerjaJS INTRO
Total soal: 90
Worksheet time: 58mins
JS can change HTML?
False
True
Which of the following are applications of JS?
Client Side
Absolute
None of the above
How Can we write variables in Js?
The Text is shown normal.
var x= 6;
None of the above
Where to put JS Scripts Tags ?
The Text is shown normal.
<head> or <body>
None of the above
Which is Single Line Comments ?
The Text is shown normal
<!--None of the above--<
// the text
Javascript can only be run on a browser.
True
False
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>
Error
Displays Hello World! Along with clickhere button
Displays Hello World! after clicking on clickhere button
Displays nothing
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>
No output
44022
10
July
2020
10
2020
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>
6
No output
Error while declaring the function
None of the above
Which of the following is wrong?
var greeting = `\`Yo\` World!`;
//output - `Yo` World!
var user = {name: 'World'};
console.log(`Thanks for getting this into V8, ${user.name.toUpperCase()}.`);
//output - Thanks for getting this into V8, WORLD.
console.log("string text line 1 \ string text line 2");
I want to extract 'hello' and 'array' from the array using destructuring
var [greeting,name] = ["Hello", "I" , "am", "Array"];
var [greeting,,,name] =
["Hello", "I" , "am", "Array"];
var array = ["Hello", "I" , "am", "Array"];
greeting = array[0];
name = array[2];
Select all the correct options.
var[greeting = "hi", name = “Array"] = ["hello"];
let person = {name: "Object", country: "India", job: "Developer"};
let {name = "Name", company = "Epsilon"} = person;
const message = `Some weird characters: \${abc}`;
var a = 10;
var b = 5;
var result = `The sum of ${a} and ${b} is ${a + b} difference is ${a-b}`;
[a, b, ...rest] = [10, 20, 30, 40, 50];
console.log(rest);
50
[30, 40, 50]
[10, 20]
let a, b;
[a=5, b=7] = [1];
console.log(a);
console.log(b)
1 7
5 7
1 1
5 1
let a = 1;
let b = 3;
[a, b] = [b, a];
console.log(a);
1
3
const arr = [1,2,3];
[arr[2], arr[1]] = [arr[1], arr[2]];
console.log(arr);
[3,1,2]
[1,3,2]
[1,2,3]
const o = {p: 42, q: true};
const {p: foo, q: bar} = o;
console.log(foo);
undefined
42
p
foo
How would we print to JS console?
console.print()
console.log()
console.log();
console.pring();
How would we use JS to get the number 4 using Arithmetic operators?
You can select more than 1
console.log(2 - 2);
console.log(6 - 2);
console.log(2 * 2);
console.log(2 / 2);
What is the correct way to use a method to print hello to your console?
console (a) ("Hello World!");
What are the three types of var in JS 6?
var
get
let
POST
const
The simplest data-storing structure in any programming language
Lists
Array
Queue
List
Local Browser used for validations on the Web Pages uses __________.
HTML
CSS
js
java
When we are done with a line what do we put at the end?
a colon :
a semi-colon ;
a period .
a quotation mark "
Which of the following will decrease the value of x?
x--;
x-1;
x=x;
x=-x;
Which of these will increase the value of the variable X?
increment (x)
x++;
x=x;
x+1;
Javascript is _________ language.
Programming
Scripting
Application
applet
JavaScript is ______ Side Scripting Language.
JSP
Servlet
Server
Browser
JavaScript is designed for following purpose -
To Style HTML Pages
To Perform Server Side Scripting Opertion
To add interactivity to HTML Pages.
To Execute Query Related to DB on Server
JavaScript is can be written -
directly into JS file and included into HTML
directly into HTML pages
directly on the Server Script
None of these
JavaScript is an ________ language.
compiled
interpreted
JavaScript Code is written inside file having extension __________.
.jsc
.jvs
.js
.javascript
Why JavaScript is called as Lightweight Programming Language ?
because JS can provide programming functionality inside but up to certain extend.
because JS is client side scripting
because JS is available free of cost.
because we can add programming functionality inside JS
Local Browser used for validations on the Web Pages uses __________.
HTML
CSS
js
java
Is this correct syntax to include JS Code inside HTML Page ?
<script type="text/javascript">
...
</script>
Yes
No
We cannot Place JS Code in the body tag . Say true/false.
True
False.
var typeOfApples="Fuji";
How can a developer show a pop-up message to the user?
alert
prompt
console.log
<p> tag
What attribute/value do we use to make a button execute JavaScript when clicked?
onclick="doSomething;"
on-click="doSomething;"
onclick="doSomething();"
onclick=doSomething();
Which of the following platform(s) can be used to run Javascript Code
Google Chrome
Firefox
Microsoft Edge
Safari
What is the correct syntax for referring to an external JavaScript script?
<script src="myscript.js"></script>
<script href="myscript.js"></script>
<js href="myscript.js"></js>
<js src="myscript.js"></js>
Which of the following statements distinguishes a programming language from a scripting language?
Programming languages are object-based, whereas scripting languages are object-oriented
Programming languages are developed by private organizations, whereas scripting languages are open-source
Programming languages are compiled, whereas scripting languages are interpreted
Programming languages are subsets of scripting languages and are interpreted
Which of the following technologies enables server-side scripting using Java Script
React
Java
Node JS
C++
Which of the following is not a feature for Java Script
Case-sensitive
Compiled Language
Object-Oriented
Platform Independent
Why should comments be included within JavaScript code blocks?
Because comments are required for each Java Script code block
Because comments deactivate all JavaScript code during debugging
Because comments provide accessibility in browsers for the visually impaired.
Because comments provide a way to indicate the intent of the code
Java Script is defined under which category of languages?
Object-Oriented (Prototype-based)
Object-Driven
Object- Independent
Object-Oriented (Class-based)
Which of the following BEST describes an Object-Oriented program?
A network of objects logically connected to one another that perform a series of tasks.
A sequence of statements that collectively performs an specific task
A collection of individual objects that perform different functions
A collection of objects that perform specific functions in a sequential order
Which of the following is used to add multiline comments in JS?
::
<!-->
//
/* */
Which of the following terms identifies the attributes that define the characteristic of an object?
Property
Method
Value
Function
Which of the following terms can perform an action by an object?
Value
Object
Method
Property
Which of the following terms specifies the quality of a property?
Value
Property
Object
Prototype
Which of the following is not a number data type in JavaScript?
-50
20.04
-1292.38101
"123"
How do comments look like in JavaScript?
//
@@
&&
**
Can you change the value of a const?
Yes
No
How many options can a boolean variable have?
1
2
3
4
Can variables change their type in JavaScript?
Yes
No
Which of the following is an invalid string?
"Hello"
`Hello`
"Hello'
'Hello'
What is the index of the letter G in 'VIBGYOR'?
1
2
3
4
Which string method makes text uppercase in JavaScript?
.toUpperCase()
.TOUPPERCASE()
.UpperCase()
.ToUpperCase()
What does the string method .trim() do?
Removes all text
Removes all whitespace
Removes a specific part of the text
Replaces whitespaces
What is the output of "Hello".indexOf('l')
3
4
-1
2
Maximum number of arguments String.slice() method can take in JS?
3
2
1
0
Select the output for 100 + "Hello"
"100Hello"
Error
"100 Hello"
"100+Hello"
Select the output for Hello World + 100
Error
"Hello World100"
"Hello World 100"
"HelloWorld100"
Which of the following is a template literal string?
`Hello`
"Hello"
'Hello'
"${Hello}"
What is the output for: `You bought ${qty} apples` if qty = 5?
"You bought ${qty} apples"
"You bought 5 apples"
Error
"You bought apples"
What is a null variable?
Unknown variable
Variable assigned a value of null
Variable without a name
Variable without a data type
What is an undefined variable?
Variable without a value
Variable assigned a value of null
Variable without a name
Variable without a data type
What is the value of Math.pow(4,6)?
1024
2048
4096
24
Which of the following is a Math.random() output?
0.6625590695007806
1
1.5590695007806
All of the above
What is the output of parseInt('Carat 24 Diamond')?
24
"Carat 24 Diamond"
"24"
NaN
