logo

CuriousTab

CuriousTab

Discussion


Home Certification Oracle Certification Comments

  • Question
  • What is the output after compile and run the following code ? int Output = 10; boolean b = false; if((b == true) && ((Output += 10) == 20)) { System.out.println("We are equal " + Output); } else { System.out.println("Not equal! " + Output); }


  • Options
  • A. Compilation and output of "We are equal 10"
  • B. Compilation and output of "Not equal! 10"
  • C. Compilation error, attempting to perform binary comparison on logical data type
  • D. Compilation and output of "Not equal! 20"

  • Correct Answer
  • Compilation and output of "Not equal! 10" 

    Explanation

    The output will be "Not equal! 10". Please note that && is logical AND operator. If first operand before (&&) is false then the other operand will not be evaluated. This illustrates that the Output +=10 calculation was never performed because processing stopped after the first operand was evaluated to be false. If you change the value of b1 to true, processing occurs as you would expect and the output would be "We are equal 20".

  • Tags: Analyst

    Oracle Certification problems


    Search Results


    • 1. Why do you need common fields in a Database?
    • Discuss
    • 2. Difference between Candidate key and Primary key?
    • Discuss
    • 3. What is the maximum number of triggers, can apply to a single table?

    • Options
    • A. 8
    • B. 10
    • C. 12
    • D. 14
    • Discuss
    • 4. Which dml command is used in conjunction with @@identity?

    • Options
    • A. INSERT and UPDATE
    • B. UPDATE and DELETE
    • C. SCOPE_IDENTITY and IDENT_CURRENT
    • D. Commit and rollback
    • Discuss
    • 5. What is Primary Key in DBMS?
    • Discuss
    • 6. In the following pieces of code, B and D will compile without any error. True or false ? A: StringBuffer sb1 = "abcd"; B: Boolean b = new Boolean("abcd"); C: byte b = 255; D: int x = 0x1234; E: float fl = 1.2;

    • Options
    • A. TRUE
    • B. FALSE
    • Discuss
    • 7. Define Executive Plan in Database SQL ?
    • Discuss
    • 8. Insert command falls in which sub-language of SQL ?

    • Options
    • A. DCL
    • B. DQL
    • C. DML
    • D. DDL
    • Discuss
    • 9. In R-DBMS, the data is organized in the form of _____.

    • Options
    • A. Hierarchical structure
    • B. Tabular structure
    • C. Linked structure
    • D. All of the above
    • Discuss
    • 10. What are the different types of SQL statements ?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment