WorksheetsFrontEnd Raibagh
Total questions: 33
Worksheet time: 24mins
Name
Class
Date
1.
Which of the following is used to store multiple values in a single variable?
a)
Variable
b)
Array
c)
Function
d)
Object
2.
Which of the following loops is guaranteed to execute at least once?
a)
for loop
b)
while lop
c)
do while loop
d)
nested loop
3.
What is the result of 5 % 2 in most programming languages?
a)
4.0
b)
3.0
c)
1.0
d)
2.0
4.
What is the keyword used to declare a constant in JavaScript?
a)
Variable
b)
let
c)
const
d)
final
5.
Which of the following is a valid function declaration in JavaScript?
a)
def myFunction()
b)
create function myFunction()
c)
function myFunction()
d)
myFunction = function()
6.
Which operator is used for logical AND in JavaScript?
a)
&
b)
&&
c)
||
d)
!
7.
How do you access the third element of an array named arr?
a)
arr.3
b)
arr[2]
c)
arr(4)
d)
arr(3)
8.
Which keyword is used to exit a loop prematurely?
a)
Continue
b)
Break
c)
Return
d)
Exit
9.
Which of the following data types is NOT primitive in JavaScript?
a)
String
b)
Number
c)
Object
d)
Boolean
10.
What is the default value of an uninitialized variable in JavaScript?
a)
null
b)
undefined
c)
NaN
11.
How do you declare a variable that can be reassigned later in JavaScript?
a)
const
b)
function
c)
let
d)
final
12.
Which of these is NOT a valid JavaScript data type?
a)
Boolean
b)
Double
c)
String
d)
Number
13.
What does typeof null return in JavaScript?
a)
"object"
b)
"null"
c)
"undefined"
d)
"number"
14.
Which of the following is true about JavaScript functions?
a)
Functions cannot return values.
b)
Functions can be assigned to variables.
c)
Functions cannot be nested.
d)
Functions do not accept parameters.
15.
What type of scope does a variable declared using var have inside a function?
a)
Block
b)
Function
c)
Global
d)
Local
16.
Which of the following correctly invokes a function named greet?
a)
call greet()
b)
greet()
c)
greet;
d)
execute greet()
17.
How do you write an arrow function that takes no parameters in JavaScript?
a)
() => {}
b)
() => { return "Hello"; }
c)
{ => }
d)
=> {}
18.
Which of the following is the correct syntax for an if statement in JavaScript?
a)
if x > 5 then
b)
if x > 5:
c)
if (x > 5)
d)
if x > 5 {}
19.
Which loop is ideal for iterating over an array?
a)
while
b)
do while
c)
for
d)
switch
20.
How can you skip an iteration in a loop in JavaScript?
a)
continue
b)
break
c)
Return
d)
exit
21.
Which of the following statements is true about a while loop?
a)
It always runs at least once.
b)
It runs as long as the condition is true.
c)
It runs a fixed number of times.
d)
It cannot be nested inside another loop.
22.
What will console.log(typeof []) return?
a)
"object"
b)
"array"
c)
"undefined"
d)
None of the above
23.
How do you define a string variable in JavaScript
a)
string name = "Hello";
b)
let name = "Hello";
c)
var name = char[10];
d)
const name: string = "Hello";
24.
Which of these is NOT a reserved keyword in JavaScript?
a)
this
b)
delete
c)
var
d)
newVar
25.
How can you convert a string to a number in JavaScript?
a)
parseInt()
b)
Number()
c)
convert()
d)
Both A and B
26.
What does the isNaN function check for in JavaScript?
a)
Whether a value is not a number
b)
Whether a variable is undefined
c)
Whether a string is empty
d)
Whether a function exists
27.
What is the difference between let and var in JavaScript?
a)
let variables cannot be reassigned, but var can.
b)
let is globally scoped, while var is block scoped.
c)
let is block scoped, while var is function scoped.
d)
There is no difference.
28.
How do you check if two values are equal in both type and value in JavaScript?
a)
='
b)
=='
c)
==='
d)
!='
29.
What is the purpose of the return statement in a function?
a)
To end the function execution
b)
To pass a value back to the caller of the function
c)
To skip to the next iteration in a loop
d)
Both A and B
30.
How do you declare an array in JavaScript?
a)
let arr = {};
b)
let arr = ();
c)
let arr = [];
d)
let arr = <>;
31.
Name
4 lines
32.
4 lines
33.
Phone No
4 lines
100 %
