Q. arrays always use numbered indexes.

  • (A) No
  • (B) Yes
  • (C) can be yes or no
  • (D) can
πŸ’¬ Discuss
βœ… Correct Answer: (B) Yes

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

  • (A) null
  • (B) undefined
  • (C) object
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. What will be the output of the below code ?

Code:
console.log( typeof( '5' + 5))
  • (A) null
  • (B) object
  • (C) string
  • (D) number
πŸ’¬ Discuss
βœ… Correct Answer: (C) string

Q. What will be the output of the below code ?

Code:
var package;
console.log("Package: " + package)
console.log("Amount: " + amount);
  • (A) Package: undefined; An ReferenceError is thrown saying amount is not defined;
  • (B) Package: null; An ReferenceError is thrown saying amount is not defined;
  • (C) Package: undefined; Amount: undefined;
  • (D) Package: null; Amount: null;
πŸ’¬ Discuss
βœ… Correct Answer: (A) Package: undefined; An ReferenceError is thrown saying amount is not defined;

Q. What will be the output of the below code ?

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) 20,False
  • (B) 20,True
  • (C) 10,False
  • (D) 10,True
πŸ’¬ Discuss
βœ… Correct Answer: (D) 10,True

Q. The statement is an example of:

Code:
while (3==3) {}
  • (A) A typographical error
  • (B) An infinite loop
  • (C) An illegal JavaScript statement
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) An infinite loop

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

  • (A) for (i=0;i<=10)
  • (B) for (i=0;i<=10;i++)
  • (C) for i=1 to 10
  • (D) for (i<=10;i++)
πŸ’¬ Discuss
βœ… Correct Answer: (B) for (i=0;i<=10;i++)

Q. What will the following JavaScript code snippet do? If not, what will be the error?

Code:
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
πŸ’¬ Discuss
βœ… Correct Answer: (C) Yes, this will work

Q. What will be the output of the following JavaScript code?

Code:
function fun_range(int l)
{
int p=2;
for(int x=0;x {
console.log(p);
}
}
range(4);
  • (A) 2
  • (B) 4
  • (C) 2222
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 2222

Q. What will be the output of the following JavaScript code?

Code:
int x=0;
for(x;x<10;x++);
console.log(x);
  • (A) 0
  • (B) 9
  • (C) 10
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 10