LAB Ecomm 2023
LAB Ecomm 2023
1. What is JavaScript?
Answer: a
b) JavaScript is Assembly-language
Answer: a
a) JavaScript is a function that is enclosed with references to its inner function scope
c) JavaScript is a function that is enclosed with the object to its inner function scope
Answer: b
<p id="demo"></p>
a) error
b) Sanfoundry_ Javascriptmcq
c) undefined
d) Sanfoundry_Javascriptmcq
Answer: d
<script>
var js = 10;
js *= 5;
document.getElementById("demo").innerHTML = js;
</script>
a) 10
b) 50
c) 5
d) Error
Answer: b
Answer: a
function compare()
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}
a) false
b) true
c) compilation error
d) runtime error
Answer: b
function equalto()
int num=10;
if(num==="10")
return true;
else
return false;
a) false
b) true
c) compilation error
d) runtime error
Answer: a
b) Memory leak
c) Error
d) Yes, perfectly
Answer: d
a) Null type
b) Undefined type
c) Number type
Answer: d
Answer: b
12. What will be the output of the following JavaScript code snippet?
int a=1;
return 1;
else
return 0;
a) 0
b) 1
c) compiler error
d) runtime error
Answer: b
13. Which of the following object is the main entry point to all client-side JavaScript features and APIs?
a) Position
b) Window
c) Standard
d) Location
Answer: b
14. What will be the output of the following JavaScript program?
function sanfoundry(javascript)
bool ans=true;
console.log(sanfoundry(ans));
a) Compilation error
b) Runtime error
c) Yes
d) No
Answer: c
15. What will be the output of the following JavaScript code?
function height()
return type;
a) short
b) 123.56
c) tall
d) 190
Answer: a
16. Which of the following can be used to call a JavaScript Code Snippet?
a) Function/Method
b) Preprocessor
c) Triggering Event
d) RMI
Answer: a
17. What will be the output of the following JavaScript function?
<p id="demo"></p>
<script>
function javascript()
document.getElementById("demo").innerHTML = Math.abs(-7.25);
</script>
a) -7.25
b) 7.25
c) -7
d) 7
Answer: b
var obj = { a : 10 }
with(obj)
alert(b)
a) 1
b) 10
c) 5
d) Error
19. Which of the following explains correctly what happens when a JavaScript program is developed on
a Unix Machine?
a) will work perfectly well on a Windows Machine
b) will be displayed as JavaScript text on the browser
c) will throw errors and exceptions
d) must be restricted to a Unix Machine only
Answer: a