Javascript String - Quiz



MCQs(multiple choice questions) and quizzes on javascript string and string functions. Evaluate your expertise on JS strings. This MCQ test covers topics like string declaration and other operations on strings.


Instructions

Topic- JS strings

The test consists of 14 questions.

No negative marking for this test.

No Time limit

The pass percentage is 70%

The correct answer with a description will be displayed after the answer has been marked.

Submit the test to calculate your score once you are done with all the questions.

Complexity Level- Moderate




Q1: Which of the following is the correct statement for string declaration in Javascript?

A. let a='hello';
B. let b="Hi";
C. let c = new String("Hi John");















Q2: Which of the following is the correct statement that finds the string length in JavaScript?

let a='hello';















Q3: Select whether the below JavaScript code is valid or not:

var x = "";












Q4: Select whether the below JavaScript code is valid or not:

let b ;
b="This is a string";











Q5: What will be the console output of the below Javascript code after applying the javascript slice function on a string?

let str1 = "kiwi, Mango, Orange";

let str2 = str1.slice(5, 11);

console.log(str2);
















Q6: Select the correct javascript code that finds the substring of the given string:

let str = "avocado, kiwi, cucumber";


















Q7: Select the correct javascript code to replace the word "Maimi" with "California":

let str = "He visited Miami last week!";




















Q8: What will be the console output of the below Javascript code?

let str = "HELLO WORLD";

let char = str.charAt(2);

console.log(char);


















Q9: Which of the following code snippets correctly changes the string into uppercase in JavaScript?

let technogeeks = 'techno-geeks for quiz and mcq';


















Q10: What will be the console output of the below Javascript code?

let text = "HELLO WORLD";
let char = text.charCodeAt(0);
console.log(char);


















Q11: Which string function is used to remove the whitespaces from both ends in the given javascript string?

let str1 = " techno-geeks! ";


















Q12: split() function in javascript is used to ______




















Q13: What will be the output of applying the startsWith() function on the below javascript string?

let str = "Hello geeks, welcome to the mcq world!";
str.startsWith("geeks");


















Q14: What will be the output of applying the includes() function on the below javascript string?

let str = "Hello geeks, welcome to the mcq world!";
str.includes("geeks");