ReactJS Assignment 2
ReactJS Assignment 2
ReactJS Assignment 2
a. Object-Oriented
b. Object-Based
c. Assembly-language
d. High-level
2) Which of the following is the correct output for the following JavaScript
code:
varx=5,y=1
with(obj)
alert(y)
a. 1
b. Error
c. 10
d. 5
a. Alternative to if-else
b. Switch statement
c. If-then-else statement
d. immediate if
4) Among the following given JavaScript snipped codes, which is more efficient:
Code A
for(var number=10;number>=1;number--)
{
document.writeln(number);
Code B
var number=10;
while(number>=1)
document.writeln(number);
number++;
a. Code 1
b. Code 2
c. Both Code 1 and Code 2
d. Cannot Compare
a. Conditional block
b. block that combines a number of statements into a single compound
statement
c. both conditional block and a single statement
d. block that contains a single statement
a. Shows a warning
b. Prompts to complete the statement
c. Throws an error
d. Ignores the statements
a. Keywords
b. Data types
c. Declaration statements
d. Prototypes
console.log(count);
count++;
a. An error is displayed
b. An exception is thrown
c. The values of count variable are logged or stored in a particular location or
storage
d. The value of count from 0 to 9 is displayed in the console
9) Which of the following is the correct output for the following JavaScript code:
Int x=8;
if(x>9)
{
document.write(9);
else
document.write(x);
a. 9
b. 0
c. 8
d. Undefined
10) Which of the following is the correct output for the following JavaScript
code:
var x=3;
var y=2;
var z=0;
If(x==y)
document.write(x);
elseif(x==y)
document.write(x);
else
document.write(z);
a. 3
b. 0
c. Error
d. 2
11) Which of the following variables takes precedence over the others if the
names are the same?
a. Global variable
b. The local element
c. The two of the above
d. None of the above
12) In the JavaScript, which one of the following is not considered as an error:
a. Syntax error
b. Missing of semicolons
c. Division by zero
d. Missing of Bracket
13) Which of the following function of the String object returns the character in
the string starting at the specified position via the specified number of
characters?
a. slice()
b. split()
c. substr()
d. search()
14) Which of the following function of the String object returns the character in
the string starting at the specified position via the specified number of
characters?
a. slice()
b. split()
c. substr()
d. search()
functioncomparison()
int number=10;
if(number==="10")
returntrue;
else
returnfalse;
a. True
b. false
c. runtime error
d. compilation error