JavaScript Questions and Answers – Types, Values and Variables | Javascript Online Quiz

Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Questions
1 JavaScript Code can be called by using ___________
A RMI
B Triggering Event
C Preprocessor
D Function/Method

Answer: Function/Method
2 The type of a variable that is volatile is _______________
A Volatile variable
B Mutable variable
C Immutable variable
D Dynamic variable

Answer: Mutable variable
Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP
3 A hexadecimal literal begins with __________
A 00
B 0x
C 0X
B Both 0x and 0X

Answer: Both 0x and 0X
4 The generalised syntax for a real number representation is __________
A [digits][.digits][(E|e)[(+|-)]digits]
B [digits][+digits][(E|e)[(+|-)]digits]
C [digits][(E|e)[(+|-)]digits]
D [.digits][digits][(E|e)[(+|-)]digits]

Answer: [digits][.digits][(E|e)[(+|-)]digits]
5 JavaScript _________ when there is an indefinite or an infinite value during an arithmetic computation.
A Prints an exception error
B Prints an overflow error
C Displays “Infinity”
D Prints the value as such

Answer: Displays “Infinity”
6 Which of the following is not considered as an error in JavaScript?
A Syntax error
B Missing of semicolons
C Division by zero
D Missing of Bracket

Answer: Division by zero
7 The escape sequence ‘\f’ stands for _________
A Floating numbers
B Representation of functions that returns a value
C \f is not present in JavaScript
D Form feed

Answer: Form feed
8 The snippet that has to be used to check if “a” is not equal to “null” is _________
A if(a!=null)
B if (!a)
C if(a!null)
D if(a!==null)

Answer: if(a!==null)
9 The statement a===b refers to _________
A Both a and b are equal in value, type and reference address
B Both a and b are equal in value
C Both a and b are equal in value and type
D There is no such statement

Answer: Both a and b are equal in value and type
10 Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator).
A false.toString()
B String(false)
C String newvariable=”false”
D Both false.toString() and String(false)

Answer: Both false.toString() and String(false)
11 What will be the output of the following JavaScript code? function compare()
{
    int num=2;
    char b=2;
    if(a==b)
        return true;
    else
        return false;
}
A true
B false
C runtime error
B compilation error

Answer: true
12 What will be the output of the following JavaScript code?
function equalto()
{
    int num=10;
    if(num===”10”)
      return true;
   else
        return false;
}
A true
B false
C runtime error
D compilation error

Answer: true
13 What will be the output of the following JavaScript code?
function compare()
{
    int a=1;
    char b=1;
    if(a.tostring()===b)
        return true;
    else 
       return false;
}
A true
B false
C runtime error
D logical error

Answer: true
14 What will be the output of the following JavaScript code?

int a==2;

int b=4;

int ans=a+b;

print(ans);

A 2
B 6
C 0
D error

Answer: error
15 What will be the output of the following JavaScript code?

int a=1;

if(a!=null)

return 1;

else

return 0;

A 1
B 0
C runtime error
D compiler error

Answer: 1

Random GK Questions

Assam Direct Recruitment Test Series

Teacher Eligibility Test

Assam Direct Recruitment Test Series