Tag: programming languages

Questions Related to programming languages

  1. AFTER statement trigger

  2. INSERT row trigger

  3. DELETE row trigger

  4. All of the above


Correct Option: A
  1. When a SELECT statement returns no rows

  2. When a SELECT statement returns more than one row

  3. When the datatypes of SELECT clause and INTO clause do not match

  4. When INTO statement is missing in the SELECT statement


Correct Option: A,B
  1. SELECT ADD(Price) FROM Sales

  2. SELECT SUM(Price) WHERE Sales

  3. SELECT TOTAL(Price) FROM Sales

  4. SELECT SUM(Price) FROM Sales


Correct Option: D
Explanation:

To solve this question, the user needs to know the correct SQL syntax for getting the total value of a column in a table. The correct SQL syntax for getting the total value of a column in a table is to use the SUM() function.

Now, let's go through each option and explain why it is right or wrong:

A. SELECT ADD(Price) FROM Sales: This option is incorrect because there is no ADD() function in SQL. The user should have used SUM() instead of ADD().

B. SELECT SUM(Price) WHERE Sales: This option is incorrect because the WHERE clause is incomplete. The correct SQL syntax would be to use the FROM keyword after the WHERE clause to specify the table from which to retrieve the data. Additionally, the correct SQL syntax for getting the total value of a column is to use the SUM() function, not the WHERE keyword.

C. SELECT TOTAL(Price) FROM Sales: This option is incorrect because there is no TOTAL() function in SQL. The user should have used SUM() instead of TOTAL().

D. SELECT SUM(Price) FROM Sales: This option is correct. The user has used the correct SQL syntax to get the total value of the 'Price' column in the 'Sales' table. The SUM() function is used to add up all the values in the 'Price' column and return the total value.

The Answer is: D

  1. SELECT COUNT(*) FROM Sales

  2. SELECT COUNT(*) IN Sales

  3. SELECT COUNTER(*) FROM Sales

  4. SELECT NUM() FROM Sales


Correct Option: A
Explanation:

To count the rows in a table, we use the COUNT() function in SQL. The correct answer is:

The Answer is: A. SELECT COUNT(*) FROM Sales

Explanation:

A. SELECT COUNT() FROM Sales: This option is correct because it uses the COUNT() function to count all the rows in the 'Sales' table. The () symbol means that we are counting all the rows.

B. SELECT COUNT(*) IN Sales: This option is incorrect because the syntax is not correct. The keyword IN cannot be used in this context.

C. SELECT COUNTER(*) FROM Sales: This option is incorrect because there is no such function as COUNTER() in SQL. The correct function name is COUNT().

D. SELECT NUM() FROM Sales: This option is incorrect because there is no such function as NUM() in SQL. We need to use the COUNT() function to count the rows in the table.

Therefore, option A is the correct answer.

  1. -

  2. -c

  3. -c2

  4. -2c

  5. -c22b

  6. -2c2b


Correct Option: B
Explanation:

To solve this question, we need to trace the execution of the code and see how the value of the variable s changes.

Starting with the main method, it creates a new instance of the Plane class and calls its method s1().

In the s1() method, it calls the method sl().

In the sl() method, it calls the method s2(). Since s2() throws an exception, execution of the sl() method is transferred to the catch block. Here, it appends "c" to the value of s.

Control is then transferred back to the s1() method, which then returns to the main method. Finally, the value of s is printed to the console, which is "-c" since the catch block was executed.

Therefore, the answer is: B. -c