{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Quiz2.fa09 - Signature cs11f CSE 11 Quiz 2 Fall 2009 Name...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Signature _____________________ CSE 11 Name ________________________ Quiz 2 cs11f ____ Fall 2009 Student ID ____________________ This quiz is to be taken by yourself with closed books, closed notes, no calculators. (Partial) Operator Precedence Table Operators Associativity * / % left to right + - left to right < <= > >= left to right == != left to right && left to right || left to right = right to left 1) What is the output of this code? (Circle correct letter.) public class Test1 { public static void main(String[] args) { int x = 1; if (x < 2) System.out.print("Hello, "); if (x > 1) System.out.print("How are you? "); else System.out.println("I am fine."); } } 2) Which of the statements below is logically equivalent to the if-conditional: if( !P && Q ) Assume for any two independent statements P and Q . (Circle correct letter.) A. if( !!P || Q ) B. if( !(P || !Q) ) C. if( !(P && !Q) ) D. if( !Q && P ) 3) What is the value of Nag after the assignment statement below? (Circle correct letter.) double Nag = 25; Nag = Nag + Nag * (1/5); A. 25.0 B. 30.0 C. 10.0 D. None of the above or an error of some kind exists (compile time or run time) A. Hello, I am fine. B. Hello, How are you? C. Hello, D. How are you? I am fine.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4) Assume a program had the following declarations: Location loc1 = new Location( 2, 3 );
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern