• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 4 fuera de 196 páginas
Examen

Data Abstraction and Problem Solving with Java Walls and Mirrors, Prichard - Exam Preparation Test Bank (Downloadable Doc)

Document preview thumbnail
Vista previa 4 fuera de 196 páginas

Description: Test Bank for Data Abstraction and Problem Solving with Java Walls and Mirrors, Prichard, 3e prepares you efficiently for your upcoming exams. It contains practice test questions tailored for your textbook. Data Abstraction and Problem Solving with Java Walls and Mirrors, Prichard, 3e Test bank allow you to access quizzes and multiple choice questions written specifically for your course. The test bank will most likely cover the entire textbook. Thus, you will get exams for each chapter in the book. You can still take advatange of the test bank even though you are using newer or older edition of the book. Simply because the textbook content will not significantly change in ne editions. In fact, some test banks remain identical for all editions. Disclaimer: We take copyright seriously. While we do our best to adhere to all IP laws mistakes sometimes happen. Therefore, if you believe the document contains infringed material, please get in touch with us and provide your electronic signature. and upon verification the doc will be deleted.

Vista previa del contenido

Chapter 1: Review of Java Fundamentals



Multiple Choice Questions:




1) Which of the following is an example of a wrapper class?

a) Double

b) int

c) String

d) System

Answer: a.



2) In order to declare a named constant, the declaration must use which Java keyword?

a) final

b) int

c) static

d) void

Answer: a.



3) If x is a variable of type int, what is the largest possible value of the expression (x % 5) ?

a) 1

b) 4

c) 5

d) 231 – 1

Answer: b.



4) What is the meaning of the declaration: String [][] a = new String [60][80]; ?

, a) Create an array of 60 strings, each of size 80 characters.

b) Create an array of 80 strings, each of size 60 characters.

c) Create a two-dimensional array of strings with 60 columns and 80 rows.

d) Create a two-dimensional array of strings with 60 rows and 80 columns.

Answer: d.



5) Which of the following loop headers will arrange for the loop body to execute exactly 10 times?

a) for (int i = 1; i < 10; ++i)

b) for (int i = 0; i <= 10; ++i)

c) for (int i = –5; i < 5; ++i)

d) for (int i = 2; i < 20; ++i)

Answer: c.



6) What type of Java statement allows you to use classes contained in other packages?

a) an access statement

b) a class statement

c) an import statement

d) a package statement

Answer: c.



7) Which access modifier, used when defining a method, indicates that only one such method is
available for all instances of the class?

a) final

b) private

c) protected

d) static

Answer: d.

,8) Suppose c1 and c2 are objects of the class Circle. A Circle has a single data member, its radius.
The Circle class has a default constructor (implemented correctly), but no other methods have
been defined in the implementation of the Circle class. What will happen when we try to execute
this code?

Circle c1 = new Circle(12.0);

Circle c2 = new Circle(12.0);

boolean same = (c1.equals(c2));

a) The code will not compile because equals( ) has not been implemented in Circle.

b) The value of same will be true.

c) The value of same will be false.

Answer: c.



9) Suppose a String variable s is initialized to the value “inheritance”. What value is returned by
the call s.substring(2, 5) ?

a) nher

b) nheri

c) her

d) heri

Answer: c.



10) Which type of loop is guaranteed to execute its body at least once?

a) do-while

b) for

c) switch

d) while

Answer: a.



11) Which of these expressions is illegal in Java?

a) x++ 5

, b) x =+ 5

c) x += 5

d) x == 5

Answer: a.



12) Suppose s is of type String. What would it mean if s.lastIndexOf(s.charAt(0)) returns the
value 1?

a) The first character appears once in the string.

b) The first two characters in the string are identical.

c) The length of the string is 2.

d) The second character of the string is ‘0’.

Answer: b.



13) If s1 is of type String, what does s1.compareTo(s1) return?

a) zero

b) true

c) false

d) Cannot be determined without knowing the value of s1.

Answer: a.



14) How many constructors can a class have?

a) Exactly one

b) At least one but no more than three

c) Exactly the same as the number of data members

d) There is no restriction on the number of constructors

Answer: d.

Libro relacionado
 image
Janet J. Prichard, Frank M. Carrano Data Abstraction & Problem Solving with Java
Editorial: Desconocido ISBN: 9780132122306 Edición: Desconocido

Información del documento

Subido en
23 de mayo de 2022
Número de páginas
196
Escrito en
2021/2022
Tipo
Examen
Contiene
Preguntas y respuestas
$40.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
tb4u
4.0
(160)
Vendido
1010
Seguidores
775
Artículos
2367
Última venta
3 días hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes