Javascript Fundamentals MCQ

This section focuses on the "Javascript Fundamentals" of the Javascript. These Multiple Choice Questions (mcq) should be practiced to improve the Javascript skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. Which of the following is a JavaScript data type?

A. null
B. undefined
C. object
D. All of the above

View Answer


2. What will be the output of the below code ?
console.log( typeof( '5' + 5))

A. number
B. string
C. object
D. null

View Answer


3. What will be the output of the below code ?
var package;
console.log("Package: " + package)
console.log("Amount: " + amount);

A. Package: null; Amount: null;
B. Package: undefined; Amount: undefined;
C. Package: null; An ReferenceError is thrown saying amount is not defined;
D. Package: undefined; An ReferenceError is thrown saying amount is not defined;

View Answer


4. What will be the output of the below code ?
var i=true;
var j=false;
var k=true;
if( i || J && K){
a=10;
b="True";
}
else {
a=20;
b="False";
}
console.log(a+","+b);

A. 10,True
B. 10,False
C. 20,True
D. 20,False

View Answer


5. The statement is an example of:
while (3==3) {}

A. A typographical error
B. An infinite loop
C. An illegal JavaScript statement
D. None of the above

View Answer


6. Which of the following is a syntactically correct for loop?

A. for (i<=10;i++)
B. for i=1 to 10
C. for (i=0;i<=10;i++)
D. for (i=0;i<=10)

View Answer


7. What are the three important manipulations done in a for loop on a loop variable?

A. Initialization,Testing, Incrementation
B. Updation, Incrementation, Initialization
C. Initialization,Testing, Updation
D. Testing, Updation, Testing

View Answer


8. What will the following JavaScript code snippet do? If not, what will be the error?
function letsfindcourse(lfc)
{
for (; lfc.next; lfc = lfc.next) ;
return lfc;
}

A. No, this will result in a runtime error with the message Cannot use Linked List
B. No, this will not iterate
C. Yes, this will work
D. No, this will throw an exception as only numerics can be used in a for loop

View Answer


9. What will be the output of the following JavaScript code?
function fun_range(int l)
{
int p=2;
for(int x=0;x {
console.log(p);
}
}
range(4);

A. 2
B. 2222
C. 4
D. error

View Answer


10. What will be the output of the following JavaScript code?
int x=0;
for(x;x<10;x++);
console.log(x);

A. 0
B. 9
C. 10
D. error

View Answer






Also check :


Discussion



* You must be logged in to add comment.