Font size
WorksheetsQuiz3
Total questions: 15
Worksheet time: 11mins
Which of the following represents control flow statements in js ?
simple if
if else
else if ladder
switch
simple if
if else
nested if
if-elif-else
simple if
if-elif-else
switch
None of the above
Which of these belong to looping statements in JS ?
for
for in
for of
for else
Find the output of the following code snippet?
<script>
var a=[1.1,2,5,'gec',99.5,'it'];
for(var x in a)
document.write(x+" "); //output1
for(var x of a)
document.write(x+" "); //output2
</script>
1.1 2 5 gec 99.5 it
0 1 2 3 4 5
1.1 2 5 gec 99.5 it
0 1 1 2 3 4
0 1 2 3 4 5
1.1 2 5 gec 99.5 it
0 1 2 3 4 5
1,1 2 5 gec 99.5 it
Which keyword is used to create functions in Javascript ?
def
define
func
function
Guess the Output for the following code snippet ?
<html>
<script>
function reverse(x){
var s=0;
while(x>0){
s=s*10+x%10;
x=x/10;
}
return s;
}
document.write("Reverse is: "+reverse(123));
</script>
</html>
Reverse is: NaN
Reverse is: 321.000
Reverse is: Infinity
Reverse is: undefined
Reverse is: 321
What is abbrevation of DOM ?
Domain Object Model
Document Object Model
Discriptive Oreintation Model
Discriptive Object Model
<html>
<script>
var x=" 68.3";
var b=Number(x);
var a=parseInt(x);
document.write(b+" ");
document.write(a);
</script>
</html>
Predict the Output ?
68 68.3
68.3 68
68 68
68.3 68.3
Which of the following are commonly used mouse events in html ?
mouseClick
mouseEntered
onsubmit
onclick
onchange
Which of the following is correct syntax for getting element by using class ?
getElementByClassName("name")[index]
getelementsByClassName("name")[index]
getElementByClassName[index]("name")
getElementsByClassName("name")[index]
Which of the following statements are correct ?
A. The innerHTML returns the content of the element ,
including spacing and all inner html tags.
B. The innertext not only return just the text content of the element,
it also returns the CSS hidden text spacing and tags,except
<script> and <style> elements
C. setAttribute() method is used to dynamically change the html tag attribute.
D. value attribute is used to assign some value ,it is not used to
reset the html element
A,B,C
A,D
B,C,D
A,C
Regular Expression always starts with symbol ?
*
#
/
[
<html>
<script>
var a=/\d{4}/;
var b="abc,234,2875,46678,sjgd";
var x=/\d{4}/g;
var y="abc,234,2875,46678,sjgd";
document.write(b.match(a)); //o/p1
alert(y.match(x)); //o/p2
</script>
</html>
o/p1 : 2875,4667
o/p2 : 2875,4667
o/p1 : 2875
o/p2 : 2875,4667
o/p1 : 2875,4667
o/p2 : 2875
none
Predict the Output?
<html>
<script>
var a=[3,4,5];
var b=[8,56,14];
var c=a.concat(b)
c.splice(3,2)
document.write(c);
</script>
</html>
3,4,5,14
3,4,5,8
5,8,56,14
3,4,5,56
<html><script>
var a=" Hakuna Matatajgsw ";
document.write(a.slice(1,14));
</script></html>
What will be the Output ?
Syntax error
Hakuna Matata
Hakuna Matatajg
compilation failed
which of the following statements are incorrect ?
i. jQuery is a javascript library .
ii. jQuery functions are Anonymous functions
iii.jQuery functions doesn't contain any document selectors .
iV.We can run jQuery in our system any time ,without considering any internet connection.
i,ii,iii
ii,iv
i,iii
iii,iv
