WorksheetsJavascript Datatypes and Variables(Kushal Das)
Total questions: 15
Worksheet time: 15mins
Name
Class
Date
1.
In Replit, we have created a file named “DemoFile.js”, which command is used to run the JavaScript code within it.
a)
run DemoFile
b)
run DemoFile.js
c)
node DemoFile
d)
node DemoFile.js
2.
JavaScript can be used for?
a)
Creating web pages
b)
Game Development
c)
Building web servers
d)
All of the Above
3.
JavaScript is ________________ typed language.
a)
Statically
b)
Dynamically
c)
Strongly
d)
None of the Above
4.
Which of the following is not a data type?
a)
String
b)
null
c)
number
d)
char
5.
___________ data type is used to represent the intentional absence of any value.
a)
undefined
b)
boolean
c)
null
d)
None of the Above
6.
What will be the output of the below code snippet:
var num;
console.log(num);a)
null
b)
undefined
c)
number
d)
string
7.
Which is the correct statement for declaring a variable "myName" with its initial value as “Kushal”? (Camel Case)
a)
var
myName="Kushal";
b)
var myname="Kushal";
c)
var MyName="Kushal";
d)
All of the above
8.
Which of the following is a valid variable name?
a)
1var 1_Name;
b)
var @_Name
c)
var _Name
d)
All of the above
9.
Best practice to declare a variable.
a)
var firstname
b)
var Firstname
c)
var firstName
d)
var FirstName
10.
What will be the output of the below code snippet:
var number = 10;
number = "hello";
console.log(number);a)
10
b)
hello
c)
10hello
d)
None of the above
11.
What will be the output of the below code snippet:
var num = 10;
num = "hello";
console.log(typeof(num));a)
number
b)
string
c)
character
d)
None of the above
12.
What will be the output of the below code snippet:
const name = "Kushal"; name = "KushalDas";
console.log(name)
a)
Kushal
b)
KushalDas
c)
undefined
d)
error
13.
What is the correct way to comment a single line in JavaScript?
a)
// This is a comment
b)
/* This is a comment */
c)
# This is a comment
d)
! This is a comment
14.
What will be the output of the below code snippet:
var x = 5;
var y = 10;
console.log(x + y);a)
15
b)
510
c)
5 + 10
d)
error
15.
Which of the following is a correct way to declare a constant variable in JavaScript?
a)
const PI = 3.14;
b)
let radius = 5;
c)
var total = 100;
d)
None of the above
100 %
