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
Document preview thumbnail
Vista previa 2 fuera de 7 páginas
Examen

ITCS 1213 UNCC FINAL EXAM QUESTIONS AND ANSWERS SOLVED CORRECTLY

Document preview thumbnail
Vista previa 2 fuera de 7 páginas

ITCS 1213 UNCC FINAL EXAM QUESTIONS AND ANSWERS SOLVED CORRECTLY Is it possible to create an array in Java where the first row has 5 elements, the second row has 6 elements and the third row has 2 elements? - Answers yes create a for loop to execute: Is it possible to create an array in Java where the first row has 5 elements, the second row has 6 elements and the third row has 2 elements? - Answers double [] [] salaries = new double [NUM_STORES][]; array[0] = new double [5]; array[1] = new double [6]; array[2] = new double [2]; Write the statement to print the number of elements in a one-dimensional array. - Answers for(i =0; ih -1; i++) { Sln(array[i]); } What does Java initialize the elements of an array of references to? - Answers null What does Java initialize an array of ints to? - Answers 0 Is an array an object? - Answers Yes int [ ] numbers = new int[16] how many objects were created? - Answers 1, new was used once Student [ ] roster = new Student[25] - how many objects were created? - Answers 1, new was used once Write the command to compile a source code file named B - Answers javac B Write the command to run a class file named B - Answers java Book Where does the execution of a Java project begin? - Answers public static void main(String [] args) How many public classes can a Java class file contain? - Answers 1 Can you declare fields of a class inside a method? - Answers No What does private access for a field mean? - Answers Only the current class will have access to the field or method. What does public access for a field mean? - Answers Any class can refer to the field or call the method. What does protected access for a field mean? - Answers Only the current class and sub classes (and sometimes also same-package classes) of this class will have access to the field or method. What happens if you do not specify the access for a field? - Answers It will set the access to package Can a sub-class also be a super-class? - Answers Yes, Java allows this What is an abstract method? - Answers It is a method that is declared, but contains no implementation What is an abstract class? - Answers Is a class that is declared abstract —it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be sub classed. Does a super class have to be abstract? - Answers No How many classes can a class directly inherit from? - Answers 1 How many interfaces can a class implement? - Answers Multiple or unlimited What can a Java interface contain? - Answers Consists of modifiers, the keyword interface, the interface name, a comma-separated list of parent interfaces (if any), and the interface body Can an interface be instantiated? - Answers You can never instantiate an interface in java. Does the is-a relationship apply to classes that implement an interface? - Answers No What is the difference between overloading a method and overriding a method? - Answers Overloading: is the ability to create multiple methods of the same name with different implementations.

Vista previa del contenido

ITCS 1213 UNCC FINAL EXAM QUESTIONS AND ANSWERS SOLVED CORRECTLY

Is it possible to create an array in Java where the first row has 5 elements, the second row has 6
elements and the third row has 2 elements? - Answers yes

create a for loop to execute: Is it possible to create an array in Java where the first row has 5 elements,
the second row has 6 elements and the third row has 2 elements? - Answers double [] [] salaries = new
double [NUM_STORES][];

array[0] = new double [5];

array[1] = new double [6];

array[2] = new double [2];

Write the statement to print the number of elements in a one-dimensional array. - Answers for(i =0;
i<array.length -1; i++)

{

System.out.println(array[i]);

}

What does Java initialize the elements of an array of references to? - Answers null

What does Java initialize an array of ints to? - Answers 0

Is an array an object? - Answers Yes

int [ ] numbers = new int[16] how many objects were created? - Answers 1, new was used once

Student [ ] roster = new Student[25] <- how many objects were created? - Answers 1, new was used
once

Write the command to compile a source code file named Book.java - Answers javac Book.java

Write the command to run a class file named Book.class - Answers java Book

Where does the execution of a Java project begin? - Answers public static void main(String [] args)

How many public classes can a Java class file contain? - Answers 1

Can you declare fields of a class inside a method? - Answers No

What does private access for a field mean? - Answers Only the current class will have access to the field
or method.

What does public access for a field mean? - Answers Any class can refer to the field or call the method.

, What does protected access for a field mean? - Answers Only the current class and sub classes (and
sometimes also same-package classes) of this class will have access to the field or method.

What happens if you do not specify the access for a field? - Answers It will set the access to package

Can a sub-class also be a super-class? - Answers Yes, Java allows this

What is an abstract method? - Answers It is a method that is declared, but contains no implementation

What is an abstract class? - Answers Is a class that is declared abstract —it may or may not include
abstract methods. Abstract classes cannot be instantiated, but they can be sub classed.

Does a super class have to be abstract? - Answers No

How many classes can a class directly inherit from? - Answers 1

How many interfaces can a class implement? - Answers Multiple or unlimited

What can a Java interface contain? - Answers Consists of modifiers, the keyword interface, the interface
name, a comma-separated list of parent interfaces (if any), and the interface body

Can an interface be instantiated? - Answers You can never instantiate an interface in java.

Does the is-a relationship apply to classes that implement an interface? - Answers No

What is the difference between overloading a method and overriding a method? - Answers Overloading:
is the ability to create multiple methods of the same name with different implementations.



Overriding: is a language feature that allows a subclass or child class to provide a specific
implementation of a method that is already provided by one of its superclasses or parent classes.

What class does every class indirectly inherit from? - Answers Object class

What is a method every class has whether you write it or not? - Answers object.equals() method

What causes a null-pointer exception? - Answers is thrown when an application attempts to use an
object reference, having the null value.

What is the purpose of the dot operator? - Answers It allows one to invoke a method within an object
when given a reference to the object

What is meant by encapsulation? - Answers is a mechanism of wrapping the data (variables) and code
acting on the data (methods) together as as single unit.

What type of Exceptions require the programmer to acknowledge? - Answers Checked Exceptions

Información del documento

Subido en
12 de julio de 2025
Número de páginas
7
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$10.89

¿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.
joshuawesonga22
3.4
(12)
Vendido
114
Seguidores
2
Artículos
14902
Última venta
4 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