1100+ javascript mcq(multiple choice) question with answers

Free JavaScript MCQ Practice Test (1100+ MCQ)

Are you ready to test your knowledge of JavaScript, mcqss provide 1100+ JavaScript MCQ (Free Multiple Choice Questions and Answers). So start practice and develop your skill level.



1. What is JavaScript?


a) A server-side programming language

b) A client-side programming language

c) Both a server-side and a client-side programming language

d) None of the above


2. What is the correct way to declare a JavaScript variable?


a) var = variableName;

b) variableName = var;

c) var variableName;

d) None of the above


3. What is the difference between == and === in JavaScript?


a) == compares values and data types, while === only compares values

b) == only compares values, while === compares values and data types

c) == and === are interchangeable

d) None of the above


4. Which statement is used to exit a loop in JavaScript?


a) continue

b) break

c) exit

d) return


5. What is the purpose of the typeof operator in JavaScript?


a) To check if a variable is null

b) To check if a variable is undefined

c) To determine the data type of a variable

d) None of the above


6. What is the result of the following code?


var num = 5;

num += 2;


a) num is now 2

b) num is now 7

c) num is still 5

d) None of the above


7. What is the result of the following code?


var x = "5";

var y = 3;

var z = x + y;


a) z is now 8

b) z is now "53"

c) z is now 35

d) None of the above


8. What is the purpose of the setTimeout() function in JavaScript?


a) To delay the execution of code

b) To execute code repeatedly at a set interval

c) To stop the execution of code

d) None of the above


9. Which of the following is not a valid JavaScript data type?


a) string

b) boolean

c) number

d) character


10. What is the result of the following code?


var arr = [1, 2, 3];

arr.push(4);


a) arr is now [1, 2, 3]

b) arr is now [1, 2, 3, 4]

c) arr is now [4, 3, 2, 1]

d) None of the above


11. Which statement is used to declare a function in JavaScript?


a) create function functionName()

b) function functionName()

c) declare function functionName()

d) None of the above


12. What is the result of the following code?


var num = 5;

num = num * 3;


a) num is now 8

b) num is now 15

c) num is still 5

d) None of the above


13. What is the purpose of the Math.random() function in JavaScript?


a) To generate a random number

b) To round a number to the nearest integer

c) To find the largest number in an array

d) None of the above


14. What is the result of the following code?


var x = 5;

var y = "5";

if (x == y) {

  console.log("Equal");

} else {

  console.log("Not equal");

}


a) Equal

b) Not equal

c) Syntax error

d) None of the above


15. What is the result of the following code?


var arr = [1, 2, 3];

arr.pop();


a) arr is now [1, 2, 3]

b) arr is now [1, 2]

c) arr is now [3


16. What is the result of the following code?


var x = 5;

var y = "5";

if (x === y) {

  console.log("Equal");

} else {

  console.log("Not equal");

}


a) Equal

b) Not equal

c) Syntax error

d) None of the above


MCQss also provide MCQ questions with answers related to IT and Programming subjects:

IT & Programming MCQs




 

Comments

Popular posts from this blog

React js multiple choice questions with answers

800+ FREE JAVA PROGRAMMING MCQs

1100+ PHP Free Exam Questions And Answers