0

programming languages Online Quiz - 307

Description: programming languages Online Quiz - 307
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

class B { public static void main (String args[]) { Double a = new Double(0xFFFF); byte b = a.byteValue(); short c = a.shortValue(); int e = a.intValue(); long f = a.longValue(); float g = a.floatValue(); double h = a.doubleValue(); System.out.print(b+","+c+","+ (e+f+g+h == 4 * 0xFFFF)); }} What is the result of attempting to compile and run the program?

  1. Prints: 0xFFFF,0xFFFF,false

  2. Prints: 0xFFFF,0xFFFF,true

  3. Prints: -1,-1,false

  4. Prints: -1,-1,true

  5. Compile-time error


Correct Option: D

class C { public static void main(String[] args) { Boolean b1 = Boolean.valueOf(true); Boolean b2 = Boolean.valueOf(true); Boolean b3 = Boolean.valueOf("TrUe"); Boolean b4 = Boolean.valueOf("tRuE"); System.out.print((b1==b2) + ","); System.out.print((b1.booleanValue()==b2.booleanValue()) + ","); System.out.println(b3.equals(b4)); }} What is the result of attempting to compile and run the program?

  1. Prints: false,false,false

  2. Prints: false,false,true

  3. Prints: true,false,false

  4. Prints: true,false,true

  5. Prints: true,true,true


Correct Option: E

class D { static boolean m(double v) { return(v != v == Double.isNaN(v)); } public static void main (String args[]) { double d1 = Double.NaN; double d2 = Double.POSITIVE_INFINITY; double d3 = Double.MAX_VALUE; System.out.print(m(d1) + "," + m(d2) + "," + m(d3)); }} What is the result of attempting to compile and run the program?

  1. Prints: false,false,false

  2. Prints: false,true,false

  3. Prints: true,false,false

  4. Prints: true,true,false

  5. Prints: true,true,true


Correct Option: E

AI Explanation

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

Option A) Prints: false,false,false - This option is incorrect because it does not match the expected output.

Option B) Prints: false,true,false - This option is incorrect because it does not match the expected output.

Option C) Prints: true,false,false - This option is incorrect because it does not match the expected output.

Option D) Prints: true,true,false - This option is incorrect because it does not match the expected output.

Option E) Prints: true,true,true - This option is correct because it matches the expected output.

The correct answer is Option E. This option is correct because the method m(double v) returns true when the input is Double.NaN (not-a-number) and true when the input is Double.POSITIVE_INFINITY (positive infinity). Therefore, when d1 is Double.NaN, m(d1) returns true. Similarly, when d2 is Double.POSITIVE_INFINITY, m(d2) returns true. However, when d3 is Double.MAX_VALUE, m(d3) returns false because Double.MAX_VALUE is a finite value and not equal to Double.NaN or Double.POSITIVE_INFINITY.

Thus, the program will print: true,true,true.

Who Led The C# Development Team?

  1. Safra A. Catz

  2. Charles Phillips

  3. Anders Hejlsberg

  4. Jeffrey O. Henley


Correct Option: C

Multiple Inheritance Is Supported In C#?

  1. True

  2. False


Correct Option: B

Sub-queries can be nested in…

  1. UPDATE, DELETE, INSERT and SELECT statements.

  2. INSERT statements only.

  3. UPDATE statements only.

  4. DELETE statements only.


Correct Option: A

Documentation System Of C# Is Similar To ?

  1. Javadoc

  2. J#

  3. C++

  4. Cdoc


Correct Option: A

What is a view?

  1. A view is a database diagram.

  2. A view is a virtual table which results of executing a pre-compiled query. A view is not part of the physical database schema, while the regular tables are.

  3. A view is a special stored procedure executed when certain event occurs.

  4. None of the above


Correct Option: B
Explanation:

To answer this question, the user needs to understand the concept of views in databases.

Option A is incorrect. A view is not a database diagram. A database diagram is a graphical representation of the database schema.

Option B is correct. A view is a virtual table that is generated from the result of a pre-compiled query. It is not part of the physical database schema, but it can be used in the same way as a regular table. Views are often used to simplify complex queries or to provide an additional level of security by limiting access to certain data.

Option C is incorrect. A view is not a stored procedure. A stored procedure is a set of SQL statements that are stored in the database and can be executed later.

Therefore, the correct answer is:

The Answer is: B

What is a database cursor?

  1. A blinking vertical line that indicates the location of the next input on the display screen.

  2. A cursor is SQL keyword specifying a retrieved data order.

  3. Cursor is acronym for Current Set Of Records and is a database object pointing to a currently selected set of records.

  4. None of the above


Correct Option: C

We can use both HAVING and WHERE SQL clauses in one SQL statement.

  1. True

  2. False


Correct Option: A

What is a foreign key?

  1. A foreign key is a key field (column) in a database table, which relates the table to another table where the key is a primary key. The primary - foreign key relations are used to cross-reference database tables.

  2. The foreign key is a SQL locking mechanism.

  3. The foreign key is a column that can have NULL values.

  4. None of the above


Correct Option: A

What does ACID stand for?

  1. Access. Consistency. Isolation. Data.

  2. Access. Constraint. Index. Data.

  3. Atomicity. Consistency. Isolation. Durability.

  4. None of the above


Correct Option: C

What does the term 'locking' refer to?

  1. Locking is the process of database authentication.

  2. Locking is a process preventing users from reading data being changed by other users, and prevents concurrent users from changing the same data at the same time.

  3. Locking is a process, which logs database usage.

  4. None of the above


Correct Option: B

The COALESCE function always produces integer results.

  1. True

  2. False


Correct Option: B

Which Organisations Co-sponsored The Submission Of Specifications For C#?

  1. Microsoft

  2. HP

  3. Intel

  4. Borland


Correct Option: A,B,C

There are two syntax options for the CASE statement but they both provide the exact same functionality.

  1. True

  2. False


Correct Option: B

AI Explanation

To answer this question, we need to understand the syntax options for the CASE statement.

The CASE statement is used in SQL to perform conditional logic and return different values based on specified conditions.

There are two syntax options for the CASE statement:

  1. Simple CASE expression: This syntax compares an expression to a set of values and returns a result based on the first matching value.

Example:

CASE expression
    WHEN value1 THEN result1
    WHEN value2 THEN result2
    ...
    ELSE resultN
END
  1. Searched CASE expression: This syntax evaluates multiple conditions and returns a result based on the first condition that evaluates to true.

Example:

CASE
    WHEN condition1 THEN result1
    WHEN condition2 THEN result2
    ...
    ELSE resultN
END

Now, let's go through each option to understand why they are correct or incorrect:

Option A) True - This option is incorrect. Although both syntax options for the CASE statement provide the same functionality of conditional logic, they have different syntax structures.

Option B) False - This option is correct. The statement is false because the two syntax options for the CASE statement have different syntax structures.

The correct answer is B) False.

There is no way to know ahead of time if you will get a Cartesian product for an answer result.

  1. True

  2. False


Correct Option: B

Which of the following functions would you need to solve the question below: Show sales figures for March incremented daily with a final total.

  1. Cumulative Sum

  2. Moving Sum

  3. RANK

  4. None of the above


Correct Option: A

AI Explanation

To solve the question of showing sales figures for March incremented daily with a final total, you would need to use the Cumulative Sum function.

Option A) Cumulative Sum - This option is correct because it allows you to calculate the running total of the sales figures for each day in March, leading to the final total.

Option B) Moving Sum - This option is incorrect because it calculates the sum of a specified number of consecutive values, rather than the running total.

Option C) RANK - This option is incorrect because it is used to assign a rank to each value in a dataset, not to calculate a running total.

Option D) None of the above - This option is incorrect because the correct answer is A) Cumulative Sum.

Therefore, the correct answer is A) Cumulative Sum because it allows you to calculate the running total of the sales figures for each day in March, leading to the final total.

We’ve just been handed an ad-hoc request for information which will require us to run a bunch of queries against a summary of last year's sales figures. What is the best choice for this situation?

  1. Derived Table

  2. Volatile Table

  3. Global Temp Table

  4. All of the above


Correct Option: B

The boss says he doesn’t care if it’s extra work. He wants that information at the end of this week and if he likes it he’s going to want it every week. What is the best choice for this situation?

  1. Derived Table

  2. Volatile Table

  3. Global Temporary Table

  4. None of the above


Correct Option: C
- Hide questions