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

  1. Safra A. Catz

  2. Charles Phillips

  3. Anders Hejlsberg

  4. Jeffrey O. Henley


Correct Option: C
  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
  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

  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

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
  1. Access. Consistency. Isolation. Data.

  2. Access. Constraint. Index. Data.

  3. Atomicity. Consistency. Isolation. Durability.

  4. None of the above


Correct Option: C
  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 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.

- Hide questions