Tag: programming languages

Questions Related to programming languages

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.

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