CSE 110 Final

¡Supera tus tareas y exámenes ahora con Quizwiz!

class Driver { public static void main(String[] args) { foo(); bar(); } static void foo() { System.out.print("foo"); bar(); } static void bar() { System.out.print("bar"); } }

b) foobarbar

Which of the following correctly declares a variable of type boolean in Java?

boolean a = false; boolean a;

class Driver { public static void main(String[] args) { foo(3); bar(5); } static void foo(int a) { System.out.print(a); } static void bar(int a) { foo(a + 1); System.out.print(a); } }

g) none of these

class Driver { public static void main(String[] args) { int a = bar(2); int b = foo(a); System.out.print(a); } static int foo(int a) { System.out.print(a); a = bar(a + 2); return a; } static int bar(int a) { System.out.print(a); return a + 5; } }

g) none of these

Which of the following correctly declares a variable of type int in Java?

int a; int a = 0;

Which of the following Java literals have the data type String?

"3.0" "true" (quotations are the reason why)

5.0/3.0, result will be what data type?

Double

class Driver { public static void main(String[] args) { foo(3); bar(5); } static void foo(int a) { bar(a + 1); System.out.print(a); } static void bar(int a) { System.out.print(a); } }

a) 435

class Driver { public static void main(String[] args) { int a = foo(3); int b = bar(a); System.out.print(b); } static int foo(int a) { a = bar(a+2); System.out.print(a); return a; } static int bar(int a) { System.out.print(a); return a + 5; } }

a) 5101015

class Driver { public static void main(String[] args) { foo(); bar(); } static void foo() { bar(); System.out.print("foo"); } static void bar() { System.out.print("bar"); } }

a) barfoobar

class Driver { public static void main(String[] args) { int a = foo(2); int b = bar(a); System.out.print(b); } static int foo(int a) { a = bar(a+2); System.out.print(a); return a; } static int bar(int a) { System.out.print(a); return a +5; } }

b) 49914

class Driver { public static void main(String[] args) { int a = bar(3); int b = foo(a); System.out.print(b); } static int foo(int a) { a = bar(a+2); System.out.print(a); return a; } static int bar(int a) { System.out.print(a); return a + 5; } }

c) 3101515

class Driver { public static void main(String[] args) { foo(3); bar(5); } static void foo(int a) { System.out.print(a); bar(a+1); } static void bar(int a) { System.out.print(a); }

c) 345

class Driver { public static void main(String[] args) { foo(); bar(); } static void foo() { System.out.print("foo"); } static void bar() { foo(); System.out.print("bar"); } }

c) foofoobar

Which of the following correctly declares a variable of type char in Java?

char a; char a = '0';

class Driver { public static void main(String[] args) { int a = bar(2); int b = foo(a); System.out.print(b); } static int foo(int a) { a = bar(a+2); System.out.print(a); return a; } static int bar(int a) { System.out.print(a); return a + 5; } }

d) 291414

class Driver { public static void main(String[] args) { foo(5); bar(3); } static void foo(int a) { System.out.print(a); bar(a+1); static void bar(int a) { System.out.print(a); } }

d) 563

class Driver { public static void main(String[] args) { bar(); foo(); } static void foo() { foo(); System.out.print("bar"); } static void bar(0 { foo(); System.out.print("bar"); }

d) foobarfoo

class Driver { public static void main(String[] args) { foo(); bar(); } static void foo() { System.out.print("foo"); } static void bar() { System.out.print("bar"); foo(); }

d) foobarfoo

Which of the following Java literals have the data type double?

3.14 3.0

Which of the following Java literals have the data type float?

3f 3.14f

3 > 5, result will be what data type?

Boolean

3> 5.0, result will be what data type?

Boolean

3 + 5, result will be what data type?

Int

5/3, result will be what data type?

Int

Which of the following would be the best data type for a variable to store the number of students enrolled at ASU?

Int

Which of the following would be the best data type for a variable to store the passenger capacity on a bus?

Int

Which of the following would be the best data type for a variable to store your age in years?

Int

What would be the best data type to store a phone number?

Int or String

"3" + "5", result will be what data type?

String

What would be the best data type to store a book title?

String

What would be the best data type to store a pet's name?

String

What would be the best data type to store a street address?

String

Which of the following are NOT Java primitive data types?

String Random Array Math class

Which of the following are NOT Java primitive data types?

String Static Array Math Class

Which of the following correctly declares a variable of type String in Java?

String a; String a = "0";

Which of the following Java literals have the data type boolean?

True False

3 + 5.0, result will be what data type?

double

3.0 + 5.0, result will be what data type?

double

3f + 5.0, result will be what data type?

double

class Driver { public static void main(String[] args) { int a = bar(3); int b = foo(a); System.out.print(b); } static int foo(int a) { System.out.print(a); a = bar(a + 2); return a; } static int bar(int a) { System.out.print(a); return a + 5; } }

e) 381015

class Driver { public static void main(String[] args) { foo(5); bar(3); } static void foo(int a) { System.out.print(a); } static void bar(int a) { foo(a+1); System.out.print(a); } }

e) 543

class Driver { public static void main(String[] args) { bar(); foo(); } static void foo() { bar(); System.out.print("foo"); } static void bar() { System.out.print("bar"); } }

e) barbarfoo

class Driver { public static void main(String[] args) { int a = bar(2); int b = foo(a); System.out.print(b); } static int foo(int a) { System.out.print(a); a = bar(a + 2); return a; } static int bar(int a) { System.out.print(a); return a + 5; } }

f) 27914

class Driver { public static void main(String[] args) { foo(3); bar(5); } static void foo(int a) { System.out.print(a); } static void bar(int a) { foo(a+1); System.out.print(a); } }

f) 365

class Driver { public static void main(String[] args) { bar(); foo(); } static void foo() { System.out.print("foo"); } static void bar() { System.out.print("bar"); foo(); } }

f) barfoofoo

Which of the following correctly declares a variable of type float in Java?

float a; float a = 0f;

Which of the following Java literals have the data type char?

'a' '\n'

Which of the following Java literals have the data type int?

123 -3

Which of the following would be the best data type for a variable to value of the numeric constant Pi?

Double

Which of the following would be the best data type for a variable to store your height in meters?

Float

Which of the following would be the best data type or a variable to store the average score on the final exam?

Float

Which of the following are Java primitive data types?

Float Boolean Char Int Double

Which of the following are Java primitive data types?

Float Int Boolean Char Double

class Driver { public static void main(String[] args) { foo(5); bar(3); } static void foo(int a) { bar(a+1); System.out.print(a); static void bar(int a) { System.out.print(a); } }

b) 653

class Driver { public static void main(String[] args) { bar(); foo(); } static void foo() { System.out.print("foo"); bar(); } static void bar() { System.out.print("bar"); } }

barfoobar


Conjuntos de estudio relacionados

ASE A6 PRO Electrical/Electronic Systems

View Set

First trimester Chapter 23 questions

View Set

RHIT Exam Questions, RHIT Exam Terminology

View Set

Muscles of Facial Expression and Mastication

View Set