Font size
WorksheetsCOM10.3.2
Total questions: 20
Worksheet time: 14mins
For string symbol + means........................
addition
swapp
concatenation
multiplication
index of a string begins with
1
0
a
-1
let string = "foo"
How to determine the length of the string?
(a)
let string = "The cat is black"
How to find the index/position of "cat" in the string
(a)
let string = "The black cat is black"
How to find the LAST index/position of "black" in the string
(a)
let string = "Milk, chocolate, cookies"
How to extract a new string "chocolate, cookies" from the first string
(a)
let string = "Milk, chocolate, cookies"
How to figure out what character is on the 3rd position of the string?
(a)
let string = "Milk, chocolate, cookies"
How to convert the string to upper case?
(a)
let string = "Milk, chocolate, cookies"
How to convert the string to lower case?
(a)
let string = " Hello World! "
How to trim the whitespaces around "Hello World!" ?
(a)
String txt = "Hello World";
alert(txt.toUpperCase());
Choose the correct output.
"HELLO WORLD"
HELLO WORLD
Hello world
Hello World
Choose correct purpose of indexOf() in String class.
returns the index (the position) of the last occurrence of a specified text in a string
returns the character of the first occurrence of a specified character in a string
returns the index (the position) of the first occurrence of a specified text in a string (excluding whitespace)
returns the index (the position) of the first occurrence of a specified text in a string (including whitespace)
Choose most appropriate purpose of trim() method in String?
to remove white spaces
to get a substring of the string
to cut String at desired index
to remove extra white spaces from start and end of String
What is the output of the given snippet?
Hello
,
true
false
What does the following code log?
-1
6
7
NaN
What does str.charAt(1) return for the string str = "Hello"?
"H"
"e"
'l'
undefined
var len = "jump it!".length;
What is the value of len?
8
7
9
6
This code does not compile.
var s = "whatever".substring(1,4);
What is the value of s?
"hate"
"hat"
"whate"
"what"
StringIndexOutOfBoundsException
var p = "Go Paw Patrol!".indexOf("p");
What is the value of p? (Case matters)
0
4
3
-1
This code will not compile.
