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

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

  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").

  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
  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

The TRUNCATE TABLE…?

  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

AI Explanation

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

Option A) checks if the table has primary key specified - This option is incorrect. The TRUNCATE TABLE statement does not check if the table has a primary key specified. It is used to delete all rows from a table, regardless of the presence of a primary key.

Option B) deletes the table - This option is incorrect. The TRUNCATE TABLE statement does not delete the table itself. It only deletes all rows from the table, leaving the table structure intact.

Option C) deletes all rows from a table - This option is correct. The TRUNCATE TABLE statement is used to delete all rows from a table, effectively removing all data from it. This is different from the DELETE statement, which can be used to delete specific rows or a subset of rows based on certain conditions.

Option D) None of the above - This option is incorrect. The correct answer is option C, as explained above.

The correct answer is C) deletes all rows from a table. This option is correct because the TRUNCATE TABLE statement is specifically used for this purpose.

Which of the following SQL clauses is used to sort a result set?

  1. ARRANGE

  2. ORDER BY

  3. SORT

  4. None Of The Above


Correct Option: B

Java is a strongly-typed language

  1. True

  2. False


Correct Option: A

AI Explanation

To answer this question, you need to understand the concept of strongly-typed languages.

Option A) True - This option is correct. Java is indeed a strongly-typed language. In strongly-typed languages like Java, each variable must be declared with its data type, and the type of a variable cannot be changed after it is declared. This strict type checking ensures that variables are used in a consistent and predictable manner.

Option B) False - This option is incorrect. Java is a strongly-typed language, as explained above.

The correct answer is A) True. Java is a strongly-typed language because it requires explicit declaration of variable types and enforces strict type checking.

A single source file can contain multiple class definitions, each having any access modifier.

  1. True

  2. False


Correct Option: B

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
  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

How you will avoid duplicating records in a query?

  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