0

Basic Javascript Quiz - 1

Description: Basic Javascript Quiz - 1
Number of Questions: 9
Created by:
Tags: javascript
Attempted 0/9 Correct 0 Score 0

A variable that your webpage can store on or retrieve from the users computer is known as ?

  1. Applet

  2. Java

  3. Cookie

  4. Session


Correct Option: C

In JavaScript, capital letters are different from lowercase letters ?

  1. Not on windows platforms

  2. Yes

  3. No

  4. Not on Linux Platform


Correct Option: B
Explanation:

To solve this question, the user needs to have basic knowledge of JavaScript syntax and understand the difference between uppercase and lowercase letters.

The answer is:

A. Yes

In JavaScript, capital letters and lowercase letters are different from each other. This means that variables named "test" and "Test" are considered two separate variables. It is important to be consistent with capitalization when naming variables and calling functions in JavaScript.

Which is detected when the mouse moves over a link ?

  1. overMouse event

  2. onMouseOver event

  3. onRollOver event

  4. OnMouseOut event


Correct Option: B

How do you read the first character in a string ?

  1. stringName.charAt(0);

  2. stringName.substring(1);

  3. stringName.charAt(1);

  4. stringName.charAt(2);


Correct Option: A

Which has no syntax error ?

  1. alert("hello "+3+" times);

  2. alert("hello "+3 times);

  3. alert("hello +3+ times");

  4. alert("hello "+3 +" times);


Correct Option: C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) alert("hello "+3+" times); - This option is incorrect because it is missing a closing quotation mark after the word "times".

Option B) alert("hello "+3 times); - This option is incorrect because it is missing a closing quotation mark after the word "times" and it does not properly concatenate the string and the number.

Option C) alert("hello +3+ times"); - This option is correct because it includes the correct syntax for concatenating a string ("hello "), a number (3), and another string (" times").

Option D) alert("hello "+3 +" times); - This option is incorrect because it is missing a closing quotation mark after the word "times".

The correct answer is C. This option has no syntax errors because it correctly concatenates the string, number, and string using the + operator and includes the necessary quotation marks.

Which method will open a new window ?

  1. popUp(PageURL,WindowName,settings);

  2. window.launch(PageURL,WindowName,settings);

  3. window.close(PageURL,WindowName,settings);

  4. window.open(PageURL,WindowName,settings);


Correct Option: D

Which method is used to search for a substring ?

  1. stringVariable.substring(subString)

  2. stringVariable.find(subString)

  3. stringVariable.indexOf(subString)

  4. stringVariable.indexOf(charAt(0))


Correct Option: C

Inside which HTML element do we put the JavaScript?


Correct Option: D
- Hide questions