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

CSE 110 Final Questions and Correct Answers

Puntuación
-
Vendido
-
Páginas
14
Grado
A+
Subido en
09-08-2024
Escrito en
2024/2025

Which reserved word in Java is used to create an instance of a class ~~ new The relationship between a class and an object is best described as... ~~ objects are instances of classes Which of the following would not be considered an algorithm? pseudocode, shopping list, recipe, computer program ~~ a shopping list if x is an int where x = 1, what will x be after the following loop terminates? while (x 100) x *= 2; ~~ 128 Decide if the printed output will be true or false: Point pointA = new Point (0.0); Point pointB = new Point(0,0); Sln(point A == pointB); ~~ false A variable whose scope is restricted to the method where it was declared is known as a ~~ local variable for the following code, where x=0, what is the resulting value of x after the for-loop terminates? for (int i =0; i = 4; i++) x += i; ~~ 10 In Java, instantiation means ~~ creating a new object What is the output generated by the following code fragment: int n = 64; int j = 1; while ( j n) { j = 2 * j; } Sln("j: " + j); ~~ 64 What are the java non-primitive data types? ~~ String, Array, Classes What is a run-time error? ~~ An error that occurs when the computer is running, when a program does not contain any syntax errors, but the computer asks the program to do something the program cannot do. What is a logic error? ~~ Otherwise known as a bug, logic errors occur when the program compiles and runs, but does the wrong thing. The process of hiding object data and providing methods for data access is called ~~ encapsulation If you do not provide a constructor in a class, what will happen? ~~ The compiler will generate a constructor with no arguments You are creating a class named Employee. How do you declare a constructor for this class? ~~ public Employee() All instance variables should be declared as private, and most instance methods should be declared as public. True or false? ~~ True A constructor can have a different name than the class? True or false? ~~ False, a constructor must have the same name as the class A constructor is invoked when what keyword is used? ~~ new How do you declare a 2D array with 20 rows and 2 columns of the type integer? ~~ int [][] num = new int [20][2]; How do you display the value in the third row and fourth column of an array? ~~ Sln(arr[2][3]); It always goes row first, column second, always subtract one from each number. Why do we used an enhanced for loop? ~~ it is convenient for traversing all th

Mostrar más Leer menos
Institución
CSE
Grado
CSE

Vista previa del contenido

CSE 110 Final Questions and
Correct Answers

What are the indexes for the first and last positions of an array called x?


✓✓~~ x[0] and x[x.length-1]




Immediately after instantiating a new array of primitives, what fills the array? What

about an array of objects?


✓✓~~ Primitive: default value fills the array (0 for int, 0.0 for double, false for boolean)




Objects: null fills array




What happens when you try to access an array element past the end of an array?


✓✓~~ An exception of type ArrayIndexOutOfBoundsException is thrown




Instantiate three arrays called x,y,and z of types int, String, and BankAccount,

respectively, all of size 10.


✓✓~~ int[] x = new int[10];
String[] y = new String[10];

BankAccount[] z = new BankAccount[10];

, What is method overloading?


✓✓~~ two methods in the same class that have the same name but different signatures (ex:
int calc(double n1, int n2) and int calc(int 1, int n2))




Use the following full array x:{4,8,5,1,6,3,2}




a. What is the value given by x[1]?

b. What is the value given by x[6]?

c. What is the value given by x[7]?

d. What is the value given by x.length?


✓✓~~ a. 8
b. 2

c. ArrayIndexOutOfBounds

d. 7




Write a for-loop to double each element in the array x given in the aray

x:{4,8,5,1,6,3,2}


✓✓~~ for(int i = 0; i<x.length; i++) {
x[i] *= 2;

}




What is a static variable?

Escuela, estudio y materia

Institución
CSE
Grado
CSE

Información del documento

Subido en
9 de agosto de 2024
Número de páginas
14
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$10.59
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


Documento también disponible en un lote

Conoce al vendedor

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.
ScholarsAscend NURSING
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
282
Miembro desde
2 año
Número de seguidores
37
Documentos
23755
Última venta
2 días hace

4.0

52 reseñas

5
27
4
10
3
8
2
1
1
6

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