0% found this document useful (0 votes)
283 views

Javascript MCQ Questions PDF

This document contains 30 multiple choice questions about JavaScript concepts and syntax. The questions cover topics like data types, operators, functions, conditional statements, and object-oriented programming principles as they relate to JavaScript. For each question, 4 possible answers are provided with only one being marked as correct.

Uploaded by

rafeak rafeak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
283 views

Javascript MCQ Questions PDF

This document contains 30 multiple choice questions about JavaScript concepts and syntax. The questions cover topics like data types, operators, functions, conditional statements, and object-oriented programming principles as they relate to JavaScript. For each question, 4 possible answers are provided with only one being marked as correct.

Uploaded by

rafeak rafeak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Javascript MCQ Questions PDF

1. Which of the following option is used as hexadecimal literal beginning?

1. 00
2. 0x
3. 0X
4. Both 0x and 0X

Answer: Both 0x and 0X

2. In the JavaScript, which one of the following is not considered as an error________

1. Missing of semicolons
2. Syntax error
3. Division by zero
4. Missing of Bracket

Answer: Division by zero

3. When there is an indefinite or an infinite value during an arithmetic computation in a


program, then JavaScript prints____________

1. Prints an overflow error


2. Prints an exception error
3. Prints the value as such
4. Displays "Infinity"

Answer: Displays "Infinity"

4. Which of the following type of a variable is volatile?

1. Dynamic variable
2. Mutable variable
3. Volatile variable
4. Immutable variable

Answer: Dynamic variable

5. Which of the following given functions of the Number Object formats a number with
a different number of digits to the right of the decimal?

1. toPrecision()
2. toFixed()
3. toExponential()
4. toLocaleString()

Answer: toFixed()
6. Which of the following function of the String object returns the character in the
string starting at the specified position via the specified number of characters?

1. split()
2. slice()
3. substr()
4. search()

Answer: substr()

7. Which one of the following is the correct way for calling the JavaScript code?

1. Triggering Event
2. Preprocessor
3. Function/Method
4. RMI

Answer: Function/Method

8. Which of the following number object function returns the value of the number?

1. valueOf()
2. toString()
3. toLocaleString()
4. DtoPrecision()

Answer: valueOf()

9. In JavaScript the x===y statement implies that____________

1. Both are equal in the value and data type


2. Both are not same at all
3. Both are x and y are equal in value only
4. Both x and y are equal in value, type and reference address as well

Answer: Both are equal in the value and data type

10. Which of the following variables takes precedence over the others if the names are
the same?

1. The local element


2. Global variable
3. The two of the above
4. None

Answer: The local element

11. Choose the correct snippet from the following to check if the variable "a" is not
equal the "NULL"_______
1. if(a!==null)
2. if (a!)
3. if(a!=null)
4. if(a!null)

Answer: if(a!==null)

12. The "function" and " var" are known as________

1. Keywords
2. Data types
3. Prototypes
4. Declaration statements

Answer: Declaration statements

13. Suppose we have a text "human" that we want to convert into string without using
the "new" operator. Which is the correct way from the following to do so___________

1. String newvariable="human"
2. String(human)
3. toString()
4. Both human.toString() and String(human)

Answer: Both human.toString() and String(human)

14. In JavaScript, what will be used for calling the function definition
expression_______

1. Function literal
2. Function calling
3. Function prototype
4. Function declaration

Answer: Function literal

15. Which of the following one is the property of the primary expression_________

1. contains variable references alone


2. Contains only keywords
3. basic expressions containing all necessary functions
4. stand-alone expressions

Answer: stand-alone expressions

16. Which one of the following is used for the calling a function or a method in the
JavaScript__________

1. Invocation expression
2. Functional expression
3. Property Access Expression
4. Primary expression

Answer: Invocation expression

17. When interpreter encounters an empty statements, what it will do_________

1. Throws an error
2. Prompts to complete the statement
3. Shows a warning
4. Ignores the statements

Answer: Ignores the statements

18. The "new Point(3,2)", is a kind of _______ expression

1. Invocation Expression
2. Primary Expression
3. Object Creation Expression
4. Constructor Calling Expression

Answer: Object Creation Expression

19. Which one of the following operator is used to check weather a specific property
exists or not__________

1. in
2. exist
3. Exists
4. within

Answer: in

20. What if we define a "for" loop and it removes one of the properties that has not yet
been enumerated?

1. The loop will not run at all


2. The removed property will be stored in a cache
3. That property will be enumerated
4. That specific property will not be enumerated

Answer: That specific property will not be enumerated

21. Which one of the following is not a keyword__________

1. with
2. if
3. debugger
4. use strict
Answer: use strict

22. Which one of the following is not considered as "statement" in the JavaScript?

1. with
2. if
3. debugger
4. use strict

Answer: use strict

23. In JavaScript, what is a block of statement?

1. block that contains a single statement


2. block that combines a number of statements into a single compound statement
3. Conditional block
4. both conditional block and a single statement

Answer: block that combines a number of statements into a single compound statement

24. In a case, where the value of the operator is NULL , the typeof returned by the
unary operator is__________.

1. string
2. undefined
3. boolean
4. object

Answer: object

25. Which one of the following is an ternary operator___________

1. +
2. ?
3. :
4. -

Answer: ?

26. Which one of the following also known as Conditional Expression__________

1. Switch statement
2. Alternative to if-else
3. If-then-else statement
4. immediate if

Answer: immediate if

27. Which one of the following operator returns false if both values are equal?
1. ==
2. !==
3. !
4. &&

Answer: ==

28. "An expression that can legally appear on the left side of an assignment expression."
is a well known explanation for variables, properties of objects, and elements of arrays.
They are called_____

1. Prototypes
2. Properties
3. Definition
4. Lvalue

Answer: Lvalue

29. What we will get if we compare the "one" with "8" using the less than operator
("one"<8)?

1. NaN
2. True
3. False
4. Undefined

Answer: False

30. Which type of JavaScript language is ___

1. Object-Based
2. Object-Oriented
3. Assembly-language
4. High-level

Answer: Object-Based

You might also like