Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

CS201 – Data Structures and Algorithms (Solved Questions & Answers)

Puntuación
-
Vendido
-
Páginas
57
Grado
A+
Subido en
07-09-2025
Escrito en
2025/2026

CS201 – Data Structures and Algorithms (Solved Questions & Answers) 1. What is the output for the Java code segment below? StringBuilder B1 = new StringBuilder("Fun"); StringBuilder B2 = B1; Bd(" Trace"); Bd(" Code"); Sln(BString() + " and " + BString()); a.) Fun and Code b.) Fun Trace and Code c.) Fun Trace and Fun Code d.) Fun Trace and Fun Trace Code e.) Fun Trace Code and Fun Trace Code f.) [Error -- the code will cause an exception] - ANSWER e.) Fun Trace Code and Fun Trace Code 2. Consider Java classes Foo and SubFoo, where SubFoo is a subclass of Foo. Which of the following Java statements are legal? a.) Foo F = new Foo(); b.) SubFoo S = new SubFoo(); c.) Foo F = new SubFoo(); d.) SubFoo S = new Foo(); - ANSWER a.) Foo F = new Foo(); b.) SubFoo S = new SubFoo(); c.) Foo F = new SubFoo(); 3. Which of the following are true with respect to Java interfaces? Indicate ALL true statements. a.) Regular instance methods are all abstract b.) Can have instance variables c.) Can instantiate objects of an interface type d.) A class may implement multiple interfaces - ANSWER a.) Regular instance methods are all abstract d.) A class may implement multiple interfaces 4. What is different in a method to sort an array of String and a method to sort an array of Integer? a.) Nothing is different about them b.) The data is compared differently in an array of String than it is in an array of Integer c.) The fundamental approach to sorting is different in the two types - ANSWER b.) The data is compared differently in an array of String than it is in an array of Integer

Mostrar más Leer menos
Institución
CS201 – Data Structures And Algorithms
Grado
CS201 – Data Structures and Algorithms

Vista previa del contenido

CS201 – Data Structures and
Algorithms (Solved Questions &
Answers)


1. What is the output for the Java code segment below?

StringBuilder B1 = new StringBuilder("Fun");
StringBuilder B2 = B1;
B1.append(" Trace");
B2.append(" Code"); System.out.println(B1.toString()
+ " and " + B2.toString());

a.) Fun and Code
b.) Fun Trace and Code
c.) Fun Trace and Fun Code
d.) Fun Trace and Fun Trace Code
e.) Fun Trace Code and Fun Trace Code
f.) [Error -- the code will cause an exception] -
ANSWER ✔ e.) Fun Trace Code and Fun Trace Code

,2. Consider Java classes Foo and SubFoo, where
SubFoo is a subclass of Foo. Which of the following
Java statements are legal?

a.) Foo F = new Foo();
b.) SubFoo S = new SubFoo();
c.) Foo F = new SubFoo();
d.) SubFoo S = new Foo(); - ANSWER ✔ a.) Foo F =
new Foo();
b.) SubFoo S = new SubFoo();
c.) Foo F = new SubFoo();

3. Which of the following are true with respect to Java
interfaces? Indicate ALL true statements.

a.) Regular instance methods are all abstract
b.) Can have instance variables
c.) Can instantiate objects of an interface type
d.) A class may implement multiple interfaces -
ANSWER ✔ a.) Regular instance methods are all
abstract
d.) A class may implement multiple interfaces

,4. What is different in a method to sort an array of
String and a method to sort an array of Integer?

a.) Nothing is different about them
b.) The data is compared differently in an array of
String than it is in an array of Integer
c.) The fundamental approach to sorting is different in
the two types - ANSWER ✔ b.) The data is compared
differently in an array of String than it is in an array of
Integer

5. Consider two Java classes, Foo and SubFoo, where
SubFoo is a subclass of Foo. Also consider the
following Java statements:

ArrayList<Foo> L1 = new ArrayList<Foo>();
ArrayList<Foo> L2;

Indicate which of the statements below are legal.
Indicate all legal statements.

a.) L1.add(new Foo());
b.) L1.add(new SubFoo());
c.) L1.add(new String("Hello"));

, d.) L2 = new ArrayList<SubFoo>(); - ANSWER ✔ a.)
L1.add(new Foo());
b.) L1.add(new SubFoo());

6. Which of the following are not legal in Java?

a.) static constants in an interface
b.) instance data in an interface
c.) A class extending more than one superclass
d.) A class implementing more than one interface -
ANSWER ✔ b.) instance data in an interface
c.) A class extending more than once superclass

7. Consider the Java interface
Comparable<T>
What does T represent in this interface?

a.) The type of the object from which compareTo() will
be called
b.) The type of the object passed in to compareTo() [i.e.
the argument type]

Escuela, estudio y materia

Institución
CS201 – Data Structures and Algorithms
Grado
CS201 – Data Structures and Algorithms

Información del documento

Subido en
7 de septiembre de 2025
Número de páginas
57
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$14.49
Accede al documento completo:

¿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

Conoce al vendedor
Seller avatar
TheComputingAcademyQnA

Conoce al vendedor

Seller avatar
TheComputingAcademyQnA Teachme2-tutor
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
-
Miembro desde
7 meses
Número de seguidores
0
Documentos
22
Última venta
-
TheComputingAcademyQnA

Welcome to ComputingAcademy – your trusted hub for Q&amp;A documents, solved past papers, and study guides in Computing and Information Technology. Whether you are preparing for exams, revising difficult concepts, or looking for quick solutions, you will find clear, accurate, and well-structured answers to help you succeed. What you will find here: Detailed Question &amp; Answer documents Exam-focused solutions to boost grades Easy-to-follow explanations in IT, Computer Science, Programming, and Networking Reliable study resources created with students in mind Who this is for: Computing and IT students Exam preparation Quick reference and revision At ComputingAcademy, learning computing is simplified.

Lee mas Leer menos
0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Documentos populares

Recientemente visto por ti

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