0

programming languages Online Quiz - 351

Description: programming languages Online Quiz - 351
Number of Questions: 21
Created by:
Tags: programming languages
Attempted 0/21 Correct 0 Score 0
  1. response.write("Hello World")

  2. document.write("Hello World")

  3. ("Hello World")

  4. "Hello World"


Correct Option: B
Explanation:

To write "Hello World" in JavaScript, the correct syntax is:

B. document.write("Hello World")

Explanation:

A. response.write("Hello World"): This is not the correct syntax. The "response" object does not have a "write" method in JavaScript.

B. document.write("Hello World"): This is the correct syntax. The "document" object represents the current web page, and the "write" method is used to write content directly to the web page. In this case, it will write "Hello World" to the page.

C. ("Hello World"): This is not the correct syntax. Parentheses alone do not have any specific meaning in JavaScript.

D. "Hello World": This is a string literal and is valid syntax in JavaScript. However, it does not actually write "Hello World" to the web page. It is just a static string value that can be assigned to a variable or used in other operations.

Therefore, the correct answer is B. document.write("Hello World").

7.How does a "for" loop start?

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

  2. for i = 1 to 5

  3. for (i <= 5; i++)

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


Correct Option: A

AI Explanation

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

Option A) for (i = 0; i <= 5; i++) - This option is the correct way to start a "for" loop. It initializes the loop variable "i" to 0, sets the condition for the loop to continue executing as long as "i" is less than or equal to 5, and increments "i" by 1 after each iteration.

Option B) for i = 1 to 5 - This option is incorrect. It does not use the correct syntax for a "for" loop in most programming languages. It is closer to the syntax used in some specific programming languages like BASIC, but it is not the standard syntax.

Option C) for (i <= 5; i++) - This option is incorrect. It does not include the initialization of the loop variable "i" and uses the incorrect order of the condition and increment statements.

Option D) for (i = 0; i <= 5) - This option is incorrect. It does not include the increment statement, which is necessary to update the loop variable and ensure the loop terminates.

The correct answer is A) for (i = 0; i <= 5; i++). This option is correct because it follows the standard syntax for a "for" loop and includes the initialization, condition, and increment statements in the correct order.

  1. SELECT * FROM Contest WHERE ContestDate < '05/25/2006'

  2. SELECT * FROM Contest HAVING ContestDate >= '05/25/2006'

  3. SELECT * FROM Contest WHERE ContestDate >= '05/25/2006'

  4. None of the above


Correct Option: C
  1. To retrieve data.

  2. To insert data.

  3. To modify data.

  4. All the above


Correct Option: B

Which SQL keyword is used to retrieve only unique values?

  1. UNIQUE

  2. DISTINCTIVE

  3. DIFFERENT

  4. DISTINCT


Correct Option: D
  1. checks if the table has primary key specified

  2. deletes the table

  3. deletes all rows from a table

  4. None of the above


Correct Option: C

Newly created threads take the priority of the threads that create them.

  1. True

  2. False


Correct Option: A

Class variables can be accessed only with the class name.

  1. True

  2. False


Correct Option: B

The finalize method will only be called once, if called at all.

  1. True

  2. False


Correct Option: A

A thread is a process

  1. True

  2. False


Correct Option: B

System class provides facilities to load files and libraries, and to create them.

  1. True

  2. False


Correct Option: B

When a method is overridden, the overriding method can throw only the same exceptions as the overridden method, a subset of them or subclasses of the exceptions.

  1. True

  2. False


Correct Option: A

All methods within a final class are implicitly final.

  1. True

  2. False


Correct Option: A

All non-assignment operators are evaluated from left to right.

  1. True

  2. False


Correct Option: A

What are various privileges that a user can grant to another user?

  1. SELECT, CONNECT, RESOURCE

  2. SELECT,INSERT,DELETE

  3. INSERT,DELETE,MODIFY,

  4. None Of The Above


Correct Option: A

Can a primary key contain more than one columns?

  1. True

  2. False


Correct Option: A
  1. DISTINCT

  2. UNIQUE

  3. DISTINCT and UNIQUE

  4. None Of The Above


Correct Option: A

Can we define exceptions twice in same block ?

  1. True

  2. False


Correct Option: B

AI Explanation

To answer this question, we need to understand how exceptions are defined in programming.

In most programming languages, including Python, it is not possible to define the same exception twice within the same block. This is because an exception is typically defined as a class or object, and you cannot have two classes or objects with the same name within the same scope.

Therefore, the correct answer is B) False.

- Hide questions