Functions Of Java Script Questions

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Saifullah
S
Saifullah
Community Contributor
Quizzes Created: 3 | Total Attempts: 2,074
| Attempts: 224 | Questions: 18
Please wait...
Question 1 / 18
0 %
0/100
Score 0/100
1. How do you write a conditional statement for executing some statements only if "i" is NOT equal to 5?

Explanation

The correct answer is "if (i != 5)". This conditional statement checks if the variable "i" is not equal to 5. If the condition is true, the specified statements within the if block will be executed.

Submit
Please wait...
About This Quiz
Functions Of Java Script Questions - Quiz

Explore key JavaScript concepts through this quiz, covering syntax, functions, and properties. Assess your understanding of embedding JavaScript in HTML, utilizing arrays, redirection, operators, and calling functions. Ideal for learners aiming to enhance their web development skills.

Personalize your quiz and earn a certificate with your name on it!
2. CHow do you find the largest number of 6 and 8?

Explanation

The correct answer is Math.max(6,8). This is because the Math.max() function is used to find the largest number among the given inputs. In this case, the function is comparing the numbers 6 and 8 and returning the larger number, which is 8.

Submit
3. What is the correct JavaScript syntax to write "Hello World"?

Explanation

The correct JavaScript syntax to write "Hello World" is document.write("Hello World"). This method is used to display text or HTML content on a web page. It allows the developer to dynamically generate content and insert it into the document.

Submit
4. What is the correct way to write a JavaScript array?

Explanation

The correct way to write a JavaScript array is by using the syntax var txt = new Array("tim","shaq","kobe"). This syntax creates a new array object called "txt" with three elements: "tim", "shaq", and "kobe".

Submit
5. Inside which HTML element do we put the JavaScript?

Explanation

In HTML, JavaScript code is typically placed inside the `

Submit
6. How do you call a function named "myFunction"?

Explanation

To call a function named "myFunction", you need to use the syntax "myFunction()". This will execute the code inside the function and perform the desired actions or computations.

Submit
7. How does a "for" loop start?

Explanation

The correct answer is "for (i = 0; i

Submit
8. How do you write a conditional statement for executing some statements only if "i" is equal to 5?

Explanation

The correct answer is "if (i==5)". This is the correct syntax for writing a conditional statement in many programming languages, including C++, Java, and Python. The "if" keyword is used to start the conditional statement, followed by the condition in parentheses. In this case, the condition is "i==5" which checks if the value of "i" is equal to 5. If the condition is true, then the statements inside the curly braces following the "if" statement will be executed.

Submit
9. How do you round the number 8.25, to the nearest whole number?

Explanation

The correct answer is Math.round(8.25). The Math.round() function is used to round a number to the nearest whole number. In this case, 8.25 is rounded to 8.

Submit
10. You define an array using

Explanation

The correct answer is "var myarray = new Array();". This is the correct way to define an array in JavaScript. The "new Array()" syntax is used to create a new instance of an array object, and assigning it to the variable "myarray" allows you to access and manipulate the array using that variable. The other options provided in the question are incorrect syntax and would result in a syntax error.

Submit
11. What is the correct JavaScript syntax for opening a new window called "window5" ?

Explanation

The correct JavaScript syntax for opening a new window called "window5" is window.open("http://www.ex-designz.net","window5"). This syntax uses the window.open() method to open a new window with the specified URL and window name.

Submit
12. Which property would you use to redirect visitor to another page?

Explanation

The correct answer is window.location.href. This property is used to redirect a visitor to another page. It is a part of the window object in JavaScript and allows the manipulation of the current URL. By assigning a new URL to this property, the browser automatically navigates to the specified page. The other options mentioned, such as document.href, java.redirect.url, and link.redirect.href, are not valid properties or methods for redirecting visitors to another page.

Submit
13. Which of the following JavaScript statements use arrays?

Explanation

The correct answer is setTimeout("a["+i+"]",1000) because it uses an array (a) and accesses a specific element of the array (a[i]) within the setTimeout function.

Submit
14. How do you find the client's browser name?

Explanation

The correct answer is navigator.appName. The navigator.appName property is used to find the name of the client's browser. It returns the name of the browser as a string. This property is commonly used in JavaScript to detect the browser type and perform browser-specific actions or optimizations.

Submit
15. How many different kind of loops are there in JavaScript?

Explanation

The correct answer is two because JavaScript has two different types of loops: the "for" loop and the "while" loop. These loops allow for repetitive execution of a block of code until a certain condition is met. The "for" loop is typically used when the number of iterations is known, while the "while" loop is used when the number of iterations is uncertain and depends on a condition.

Submit
16. Onclick is equivalent to which two events in sequence

Explanation

The onclick event is triggered when a user clicks on an element. This event is equivalent to the onmousedown event, which occurs when the mouse button is pressed down, and the onmouseup event, which occurs when the mouse button is released. Therefore, the correct answer is "onmousedown and onmouseup".

Submit
17. Wich best describe void?

Explanation

Void is not a method, function, or statement. In programming, void is a data type that represents the absence of a value. It is often used to indicate that a method or function does not return any value. However, void is not an operator either, as operators are symbols or keywords used to perform specific operations on data. Hence, the correct answer is that void is not an operator.

Submit
18. How do you put a message in the browser's status bar?

Explanation

The correct answer is "window.status = 'put your message here'". This is because the "window.status" property allows you to set the text that appears in the browser's status bar. By assigning a message to this property, you can display your desired message in the status bar. The other options provided ("statusbar = 'put your message here'", "status('put your message here')", "window.status('put your message here')") are incorrect and will not achieve the desired result.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 27, 2015
    Quiz Created by
    Saifullah
Cancel
  • All
    All (18)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
How do you write a conditional statement for executing some statements...
CHow do you find the largest number of 6 and 8?
What is the correct JavaScript syntax to write "Hello World"?
What is the correct way to write a JavaScript array?
Inside which HTML element do we put the JavaScript?
How do you call a function named "myFunction"?
How does a "for" loop start?
How do you write a conditional statement for executing some statements...
How do you round the number 8.25, to the nearest whole number?
You define an array using
What is the correct JavaScript syntax for opening a new window called...
Which property would you use to redirect visitor to another page?
Which of the following JavaScript statements use arrays?
How do you find the client's browser name?
How many different kind of loops are there in JavaScript?
Onclick is equivalent to which two events in sequence
Wich best describe void?
How do you put a message in the browser's status bar?
Alert!

Advertisement