Javascript Quiz Test (25)

1.

JavaScript is a __ language ?

A. scripting

B. non-scripting

C. classtring

D. All of the above



2.

If we execute the following code what will be the output ?

 

var x = 0;
var y = 1; 
var z = x/y;  
console.log(z);

A. 0

B. error

C. undefine

D. fatal error



3.

What will be the output of the following code ?

 

int  m = 10;
char n = 10;

if(m == n){
   return true;
}else{
   return false;
}

A. Runtime error

B. Error

C. False

D. True



4.

What will be the output of the js code ?

 

int  m = 10;

if(m === "10"){
    return true;
}else{
  return false;
}

A. False

B. True

C. Compilation error

D. Error



5.

What will happen after run following code snippet ?

 

//first code
var js_without_function_name = (function(m) {return m*m;}(5));


//second code
function js_without_function_name(m){
  var js = m*m;
}
js_without_function_name(5)

A. Both result will be same

B. Both result will be different

C. First code is wrong

D. Second code is wrong



6.

In which HTML element do we put the JavaScript code?

A. <js>

B. <javascript>

C. <script>

D. <scrippting>



7.

Which of the following is the right JavaScript syntax to change the content of the HTML element?

<h2 id="change">Hello change me</h2>

 

 

A. document.getElementById("change").innerHTML = "I have changed";

B. #change.innerHTML = "I have changed";

C. document.getElement("h2").innerHTML = "I have changed";

D. document.getElementByName("h2").innerHTML = "I have changed";



8.

What is the right syntax for referring to an external script called "webjourney.js"?

 

 

A. <script name="webjourney.js">

B. <script href="webjourney.js">

C. <script src="webjourney.js">

D. <script link="webjourney.js">



9.

External JavaScript file must contain the <script> tag. True or False ?

A. False

B. True

C. Both A & B

D. It depends



10.

what is the correct syntax to write "Hello World" in an alert box?

A. msg("Hello World");

B. alert("Hello World");

C. msg.alert("Hello World");

D. alert.msg("Hello World");



11.

How can we call a function named "myFunction" in javaScript?

A. call myFunction()

B. call function myFunction()

C. this.myFunction

D. myFunction()



12.

What of the following is the correct approach to detect the client's browser name?

 

A. navigator.appName

B. browser.name

C. client.navName

D. window.appName



13.

JavaScript is the same as Java.

A. True

B. False

C. Almost same

D. None of the above



14.

How does a WHILE loop start?

 

A. while (a <= 5; a++)

B. while a = 1 to 5

C. while (a <= 5)

D. while(let a=5; a<=5)



15.

How does a FOR loop start in javascript?

A. for(i=0; i<=5)

B. for(i<=0;i++)

C. for(i=0;i<=5;i++)

D. Both A & C



16.

How do you find the number with the highest value of a and b in javascript?

A. floor(a,b)

B. Math.ceil(a, b)

C. ceil(a, b)

D. top(a, b)



17.

What will be the value of the bellow variable position?

 

let text = "Hello welcome to, webjourney.";
let position = text.indexOf("webjourney");

 

A. 17

B. 18

C. 19

D. 20



18.

Which of the bellow one is not a JavaScript Data Types?

A. String

B. Undefined

C. Boolean

D. Float



19.

Which software company developed javascript?

A. Netscape

B. Microsoft

C. Sun Microsystems

D. IBM Team



20.

Which of the following is JavaScript ignores?

A. spaces

B. tabs

C. newlines

D. All of the above



21.

What would be the possible result of 2+1+”7″?

A. 37

B. 10

C. 3

D. None of the above



22.

In Javascript which value is responsible to represent no value or no object __

A. NULL

B. Empty

C. Undefine

D. All of the above



23.
var person= {name:"Nazmul Hoque", email:"nazmul@ex.com"};

What is the way to delete person name?

A. Delete person. name;

B. Remove person. name;

C. Prop person. name;

D. Exclude person. name;



24.

Which of the bellow one is used to prevent the page from reloading?

A. javascript(0)

B. Void(0)

C. #0

D. Void(1)



25.

 By default all JavaScript variables are object data types__

A. All of the bellow

B. No data types in js

C. No

D. Yes



Categories