

MCQOPTIONS
Saved Bookmarks
This section includes 15 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
1. |
The Function() constructor expects ______ number of string arguments |
A. | 0 |
B. | 1 |
C. | 2 |
D. | any |
E. | |
Answer» E. | |
2. |
Does JavaScript allows us to write our own functions as well? |
A. | Yes |
B. | No |
C. | Can be yes or no |
D. | Can not say |
Answer» B. No | |
3. |
Which statement required if you want to return a value from a function? |
A. | continue |
B. | break |
C. | loop |
D. | return |
Answer» E. | |
4. |
The most common way to define a function in JavaScript is by using the ____________ keyword. |
A. | fun |
B. | var |
C. | function |
D. | define |
Answer» D. define | |
5. |
var x = 10; y = --x + 1; alert(y); Code B: var x = 10; y = x-- + 1; alert(y); |
A. | exception |
B. | function |
C. | loop |
D. | switch |
Answer» C. loop | |
6. |
var name = "Bench"; alert(name); } |
A. | 10,10 |
B. | 10,11 |
C. | 11,10 |
D. | 11,11 |
Answer» C. 11,10 | |
7. |
Variable declared is example of ___________ Variable. |
A. | Local |
B. | Global |
C. | Semi-Global |
D. | None of the above |
Answer» B. Global | |
8. |
When you invoke the........ method on a function f and pass an object o, the method returns a new function. |
A. | apply() |
B. | call() |
C. | bind() |
D. | string() |
Answer» D. string() | |
9. |
........ functions need not allow invocations with zero arguments. |
A. | zero |
B. | strict |
C. | empty |
D. | varargs |
Answer» E. | |
10. |
function cal() { num1=10; num2=5; num3=num2*num1; console.log(num3); } cal(); |
A. | invocation statement |
B. | invocation expression |
C. | invocation function |
D. | invocation method |
Answer» C. invocation function | |
11. |
console.log(chaval(2)); |
A. | 25 |
B. | 50 |
C. | 100 |
D. | Error cannot have more than one variable with same name |
Answer» C. 100 | |
12. |
for (i = 0; i < pass.length; i++) { } } function name(pname) { console.log("The value of i is "+i); for (i = 0; i < pname.length; i++) { } } password("54321"); name("John"); |
A. | 4 |
B. | 22 |
C. | Error: changeVal is not a function |
D. | undefined |
Answer» B. 22 | |
13. |
console.log(x*x); } // line 4 |
A. | 0 |
B. | 5 |
C. | undefined |
D. | error |
Answer» C. undefined | |
14. |
console.log(10+"lfc" +12); } res=lfc(10); console.log(res); //line 5 |
A. | thisfun(10) |
B. | lfc(10) |
C. | function thisfun(10) |
D. | None of the above |
Answer» B. lfc(10) | |
15. |
Consider the JavaScript code:Identify the value that will be displayed in alert box at line 5? |
A. | 10 |
B. | 10lfc12 |
C. | undefined |
D. | 10lfc |
Answer» D. 10lfc | |