JavaScript String MCQ Questions & Answers
Javascript (JS) String MCQs : This section focuses on the "Javascript String". These Multiple Choice Questions (MCQs) should be practiced to improve the Javascript skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. JavaScript strings are for ________ text.
A. storing
B. manipulating
C. both a and b
D. none of the above
View Answer
Ans : C
Explanation: JavaScript strings are for storing and manipulating text.
2. To find the length of a string, use the built-in _______ property.
A. size
B. length
C. area
D. strlen
View Answer
Ans : B
Explanation: To find the length of a string, use the built-in length property.
3. The ________ escape character turns special characters into string characters
A. \
B. /
C. |
D. #
View Answer
Ans : A
Explanation: The backslash () escape character turns special characters into string characters
4.
code is used for?
A. Backspace
B. Form Feed
C. New Line
D. Carriage Return
View Answer
Ans : D
Explanation:
: Carriage Return
5. The _________ keyword complicates the code and slows down execution speed
A. this
B. let
C. new
D. none of the above
View Answer
Ans : C
Explanation: The new keyword complicates the code and slows down execution speed
6. Comparing two JavaScript objects always returns?
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : B
Explanation: Comparing two JavaScript objects always returns false.
7. _______ extracts a part of a string and returns the extracted part in a new string.
A. substring()
B. substr()
C. strlen()
D. slice()
View Answer
Ans : D
Explanation: slice() extracts a part of a string and returns the extracted part in a new string.
8. JavaScript counts positions from?
A. 0
B. 1
C. -1
D. Can not say
View Answer
Ans : A
Explanation: JavaScript counts positions from zero.
9. _________ cannot accept negative indexes.
A. slice()
B. substring()
C. both a and b
D. none of the above
View Answer
Ans : B
Explanation: substring() is similar to slice(). The difference is that substring() cannot accept negative indexes.
10. Some browsers do not allow spaces behind the character.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: The method is not the preferred method. It might not have universal support. Some browsers do not allow spaces behind the character.
Discussion