Java wrong question

Source: Internet
Author: User

Bold for the correct answer, green for the wrong answer

1. For the following code:

    1. For ( int i=0; i<; i++)

System.out.println (i);

What is the value of I after the For loop?

    • A.I no longer exists (I definition within a for loop)
    • B.9
    • c.11
    • d.10
5 The following code snippet compiles the result of the run:
  1. int output=ten;
  2. Boolean B1 = false;
  3. If(b1==true) && ((output+=) = =)) {
  4. System.out.println ("We are equal"+output);
  5. } Else {
  6. System.out.println ("Not equal!" +output);
  7. }
    • A. Output "Not equal!"?
    • B. Output "We are equal 10"
    • c. Output "not equal! 10" (as with the C language mechanism, after judging b1==true as false, it is not behind the judgment. ) )
    • D. Compilation errors

19. The following method, when the value of the parameter is 2, what is the return value?
  1. public int getValue (int i) {
  2. int result = 0;
  3. Switch (i) {
  4. Case 1:
  5. result = result + I;
  6. Case 2:
  7. result = result + I * 2;
  8. Case 3:
  9. result = result + I * 3;
  10. } 
  11. return result;
  12. }
    • A.10 (no break)
    • B.8
    • C.4
    • d.0
correct answer:A You are wrong to choose c 23.Java of various data types occupy a fixed length, independent of the specific hardware and software platform environment
    • A. For
    • B. Wrong
correct answer:B You are wrong to choose a

Java wrong question

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.