Quiz 03 (Part 1)_ CSE 205_ H-T-CSE205-SP24

pdf

School

Arizona State University *

*We aren’t endorsed by this school

Course

205

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

10

Uploaded by BarristerFlag12929

Report
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 1/10 Quiz 03 (Part 1) Due Feb 11 at 11:59pm Points 100 Questions 25 Available until Apr 28 at 11:59pm Time Limit 30 Minutes Allowed Attempts 3 Instructions You may take this quiz 3 times before the due date passes The questions will be different each time you take it Your highest score will be recorded in the Canvas Grades No extensions of the due date will be granted for any missed quiz This quiz has a 30 minute time limit If you are not able to successfully answer all questions within the time limit, then you may need more study and practice This quiz covers the following topics: Objects and Classes Object Oriented Programming Data types Value types vs Reference Types Methods Nested Loops IMPORTANT: This assignment is due before the Due date listed on this page. The Available until date is not the due date. No points may be awarded for any work that is submitted after the Due date. As
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 2/10 Attempt History Attempt Time Score LATEST Attempt 1 21 minutes 100 out of 100 Correct answers are hidden. Score for this attempt: 100 out of 100 Submitted Feb 11 at 4:04pm This attempt took 21 minutes. Question 1 4 / 4 pts none of these Mr. bob (first name smith) is 3 inches tall and 67 years old Mr. bob (first name smith) is 67 inches tall and 3 years old Mr. smith (first name bob) is 3 inches tall and 67 years old Mr. smith (first name bob) is 67 inches tall and 3 years old Question 2 4 / 4 pts Mr. bob (first name smith) is 3 inches tall and 67 years old stated in the syllabus due dates will not be extended or excused. Take the Quiz Again Evaluate the following code to determine the output. int age = 3; String fname = "bob"; String lname = "smith"; int inches = 67; System.out.printf("Mr. %s (first name %s) is %d inches tall and %d years old", lname, fname, inches, age); Evaluate the following code to determine the output. int age = 3; String fname = "bob"; String lname = "smith"; int inches = 67; System.out.printf("Mr. %s (first name %s) is %d inches tall and %d years old", fname, lname, inches, age);
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 3/10 Mr. smith (first name bob) is 67 inches tall and 3 years old none of these Mr. smith (first name bob) is 3 inches tall and 67 years old Mr. bob (first name smith) is 67 inches tall and 3 years old Question 3 4 / 4 pts null void none of these nil none Question 4 4 / 4 pts ! none of these && || Question 5 4 / 4 pts parenthesis curly brace semicolon colon none of these Question 6 4 / 4 pts The Java keyword used to declare that a method does not return a value is _____. Which of the following is not a Java logical operator? Java statements generally end with a _____.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 4/10 none of these new fastFood = Restaurant("Taco Bell", 3); new Restaurant diner = Restaurant(); Restaurant diner = new Restaurant(3, "Taco Bell"); new Restaurant rest = Restaurant(); Restaurant rr = new Restaurant("Chili's"); String rest = new Restaurant("Chili's", 3); Restaurant chillis = new Restaurant(); Restaurant fastFood = new Restaurant("Taco Bell", 3); int rr = new Restaurant(); Question 7 4 / 4 pts Given the following class definition, which statements will instantiate an object of this class? Choose all that apply. class Restaurant { private String name; private int rating; public Restaurant() { this.name = "no name"; this.rating = 0; } public Restaurant(String initName, int initRating) { this.name = initName; this.rating = initRating; } } Given the following class definition, which statements will instantiate an object of this class? Choose all that apply. class Restaurant { private String name; private int rating; public Restaurant() { this.name = "no name"; this.rating = 0; } public Restaurant(String initName, int initRating) { this.name = initName; this.rating = initRating; } }
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 5/10 none of these String rest = new Restaurant("Taco Bell", 3); Restaurant tacoBell = Restaurant(); Restaurant diner = Restaurant("Taco Bell", 3); new Restaurant chillis = Restaurant(); new Restaurant rr = Restaurant("Chilli's", 5); Restaurantyour r = new Restaurant(5, "Chilli's"); Restaurant rest = new Restaurant("Taco Bell"); new Restaurant diner = Restaurant(); new rr = Restaurant("Taco Bell", 3); Question 8 4 / 4 pts 51 Question 9 4 / 4 pts 42 Question 10 4 / 4 pts Evaluate the following code to determine the output. int x = 94, y = 72; y = x; y = 51; System.out.println(y); Evaluate the following code to determine the output. int x = 42, y = 63; y = x; y = 8; System.out.println(x); Evaluate the following code to determine the output.
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 6/10 80 Question 11 4 / 4 pts 23 Question 12 4 / 4 pts True False Question 13 4 / 4 pts destroyed initialized none of these class Foo { public int i = 84; public Foo(int i) { this.i = i; } } ... Foo x = new Foo(33), y = new Foo(80); x.i = y.i; y.i = 9; System.out.println(x.i); Evaluate the following code to determine the output. class Foo { public int i = 99; public Foo(int i) { this.i = i; } } ... Foo x = new Foo(31), y = new Foo(54); y = x; y.i = 23; System.out.println(x.i); A variable of a primitive type can never be empty. When there are no remaining references to an object, the object will be _____.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 7/10 instantiated created Question 14 4 / 4 pts True False Question 15 4 / 4 pts True False Question 16 4 / 4 pts True False Question 17 4 / 4 pts True False Question 18 4 / 4 pts True False Question 19 4 / 4 pts The benefit of data hiding is that we can make an object truly responsible for what it knows and what it does. Encapsulation is about assigning responsibilities to objects. In general, data hiding means that an object keeps what it knows private. We can more easily debug a program when the responsibilities are well encapsulated. Data hiding can allow us to separate the information from its representation.
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 8/10 calls delegates does none of these resembles knows Question 20 4 / 4 pts True False Question 21 4 / 4 pts none of these new make build create Question 22 4 / 4 pts buffers none of these scope modifiers access modifiers Question 23 4 / 4 pts operations are things an object _____. An object is an instance of a class. Which keyword is used in Java to create an object? The Java keywords "public" and "private" are called _____. What is the output of this Java program?
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 9/10 644 Question 24 4 / 4 pts 244 Question 25 4 / 4 pts class Driver { public static void main(String[] args) { int a = foo(3); int b = bar(4); } static int foo(int a) { a = bar(a + 3); System.out.print(a); return a; } static int bar(int a) { System.out.print(a); return a - 2; } } What is the output of this Java program? class Driver { public static void main(String[] args) { int a = bar(2); int b = foo(a); } static int foo(int a) { System.out.print(a); a = bar(a - 0); return a; } static int bar(int a) { System.out.print(a); return a + 2; } } What is the output of this Java program? class Driver { public static void main(String[] args) { int a = 11; int b = 0;
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2/18/24, 4:53 PM Quiz 03 (Part 1): CSE 205: H-T-CSE205-SP24 https://canvas.asu.edu/courses/175602/quizzes/1321124 10/10 47 Quiz Score: 100 out of 100 for (int c = 3; c <= 5; c++) { b = 0; while (b < c) { b = b + 1; a = a + b; } b = b + a; } System.out.print(b); } }