Java Scaript FQS
Java Scaript FQS
a) var
b) let
c) both a and b
d) None of the above
3. Which of the following methods is used to access HTML elements using Javascript?
a) getElementbyId()
b) getElementByClassName
c) both a and b
d) None of the above
4. Upon encountering empty statements, what does the Javascript Interpreter do?
a) Throws an error
b) Ingnore the statement
c) Giveing Wraning
d) Non of the above
5. Which of the following methods can be used to display data in some form using
Javascript?
a) document.write()
b) console.log()
c) window.alert()
d) All of the above
.
6.How can a datatype be declared to be a constant type?
a) const
b) var
c) let
d) constant
7. What will be the output of the following code snippet?
<script type="text/javascript">
a = 5 + "9";
document.write(a);
</script>
a) Compilation Error
b) 14
c) Run Time Error
d) 59
8. What will be the output of the following code snippet?
a) 20
b) x+y
c) 128
d) Non of The above
10. When the switch statement matches the expression with the given labels, how is
the comparison done?
a) Both the data type and the result of the expression are compared.
b) only the datatype of the expression is compared.
only the value of the expression is compared
d) Non of The above
11. What keyword is used to check whether a given property is valid or not?
a) in
b) is in
c) exists
d) lies
12. What is the use of the <noscript> tag in Javascript?
a) The contents are displayed by no-JS based browsers.
b) Clears all the cookies and cache.
c) Both A and B
d) Non of The above
13. What will be the output of the following code snippet?
(function(){
setTimeout(()=> console.log(1),2000);
console.log(2);
setTimeout(()=> console.log(3),0);
console.log(4);
})();
a) 1 2 3 4
b) 2 3 4 1
c) 2 4 3 1
d) 4 3 2 1
14. What will be the output of the following code snippet?
(function(a){
return (function(){
console.log(a);
a = 6;
})()
})(21);
a) 6
b) NaN
c) 21
d) Non of the Above
15. What will be the output of the following code snippet?
a) [111,44,1,22]
a) [44,1,22,111]
a) [111,44,22,1]
a) [1,22,111,44]
16. What will be the output for the following code snippet?
<p id="example"></p>
<script>
function Func()
{
document.getElementById("example").innerHTML=Math.sqrt(81);
}
</script>
a) 9
b) 81
c) Error
d) 0
17. When an operator’s value is NULL, the typeof returned by the unary operator is:
a) Boolean
b) Unifined
c) Object
d) Integer
18. What will be the output of the following code snippet?
var a = 1;
var b = 0;
while (a <= 3)
{
a++;
b += a * 2;
print(b);
}
a) 4 10 18
b) 1 2 3
c) 1 4 7
d) None of the above
19. What does the Javascript “debugger” statement do?
a) true
b) false
c) undefined
d) Error
24. What will be the output of the following code snippet?
print(typeof(NaN));
a) Object
b) Number
c) String
d) Non of the above
25. What does the ‘toLocateString()’ method do in JS?
a) Returns a localised object reprasentation.
b) Returns a parsed string
c) Returns a localized string reprasentation of the objects
d) Non of the above
26. Which function is used to serialize an object into a JSON string in Javascript?
a) stringfy()
b) parse()
c) convert()
d) None of the above
28.
The 3 basic object attributes in Javascript are:
let sum = 0;
const a = [1, 2, 3];
a.forEach(getSum);
print(sum);
function getSum(ele) {
sum += ele;
}
a) 6
b) 1
c) 2
d) None of the above
30. What will be the output of the following code snippet?
a = [1, 2, 3, 4, 5];
print(a.slice(2, 4));
a) 3,4
b) 2,3
c) 3,4,5
d) 2,3,4
31. What will be the output of the following code snippet?
print(parseInt("123Hello"));
print(parseInt("Hello123"));
a) 123 NaN
b) 123Hell0 Hello123
c) NaN NaN
d) 123 123
32. Which of the following are closures in Javascript?
a) Variables
b) Functions
c) Objects
d) All of The above
33. Which of the following is not a Javascript framework?
a) Node
b) Vue
c) React
d) Cassandra
34. What will be the output of the following code snippet?
var a = "hello";
var sum = 0;
for(var i = 0; i < a.length; i++) {
sum += (a[i] - 'a');
}
print(sum);
a) 47
b) NaN
c) 0
d) None of the above
35. What keyword is used to declare an asynchronous function in Javascript?
a) async
b) await
c) setTimeout
d) None of the above
36. How to stop an interval timer in Javascript?
a) clearInterval
b) clearTimer
c) intervalOver
d) None of the above