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 4 fuera de 43 páginas
Examen

CSCI 2010 Mock Midterm Exam, Computer Science 2010, Practice MCQs with Answer Key 2026

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

This document contains multiple-choice questions for CSCI 2010, designed as a mock midterm exam with a complete answer key. It covers core topics typically assessed in the midterm and is ideal for exam preparation and self-testing.

Vista previa del contenido

] CSCI 2010 – Mock Midterm Exam
(MCQs) with Answers key
Section A: Java Basics & Output

1. If you compile a Java source file containing a class called MyApp, what is the name of the
resulting file?
A. MyApp.java
B. MyApp.class
C. MyApp.txt
D. MyApp.exe



2. Given the code:

String greeting = "Hello there!";
System.out.println(greeting.length());


What is displayed?
A. 11
B. 12
C. 13
D. 14



3. Which object is used to display normal output to the screen?
A. Scanner
B. System.out
C. Console
D. PrintStream



4. Which statement reads an integer from the keyboard?
A. number = keyboard.readInt();
B. number = keyboard.nextInt();
C. number = System.in.readInt();
D. number = Scanner.next();




Page 1 of 43 3/21/2026, 6:54:41 PM

, 5. Which keyword is NOT required when declaring a named constant?
A. final
B. void
C. public
D. static



6. The Java compiler translates source code into:
A. Machine code
B. Assembly code
C. Bytecode
D. Object code



7. Which is used to display formatted output?
A. System.out.print()
B. System.out.println()
C. System.out.printf()
D. print.format()




Section B: Classes & Objects

8. What is the relationship between a class and an object?
A. A class is a blueprint for creating objects
B. An object is a blueprint for creating classes
C. Classes and objects are equivalent
D. Objects cannot exist without classes



9. Which of the following does NOT increase the value of number by 1?
A. number += 1
B. number + 1
C. number = number + 1
D. number++



10. Correct way to test if two strings s1 and s2 are exactly the same:
A. s1 == s2
B. s1.equals(s2)
C. s1.compareTo(s2)
D. s1.equalsIgnoreCase(s2)




Page 2 of 43 3/21/2026, 6:54:41 PM

, 11. Difference between a while loop and a do-while loop:
A. while evaluates after the loop; do-while before
B. while evaluates before the loop; do-while after
C. while runs once; do-while may not run
D. No difference



12. Why is using a DEBUG flag helpful when tracing variables?
A. It allows variables to be hidden
B. It turns tracing messages on and off easily
C. It speeds up compilation
D. It prevents runtime errors



13. What is displayed by the code:

for (int i = 1; i <= 5; i++)
if (i == 4)
break;
System.out.println("boing");


A. boing boing boing boing
B. boing boing boing
C. boing boing
D. boing



14. Which Java type is used for true/false values?
A. Boolean
B. boolean
C. int
D. String



15. Correct way to call the exit method in Java:
A. exit(0);
B. System.exit(0);
C. System.terminate();
D. exitProgram();



16. Correct way to declare an enumeration:
A. enum Suits { HEARTS, SPADES, DIAMONDS, CLUBS }
B. enum Suits = [HEARTS, SPADES, DIAMONDS, CLUBS];




Page 3 of 43 3/21/2026, 6:54:41 PM

, C. enum Suits();
D. enum Suits { "HEARTS", "SPADES", "DIAMONDS", "CLUBS" };




Section C: Loops & Methods

17. Equivalent while loop for:

for (count = 0; count < 4; count++)
System.out.println(count);


A. count = 0; while (count < 4) { count++; }
B. count = 0; while (count < 4) { System.out.println(count); count++; }
C. count = 1; while (count < 4) { System.out.println(count); }
D. count = 0; while (count <= 4) { System.out.println(count); count++; }



18. How does a while loop work?
A. Repeats the body until the controlling expression is false
B. Repeats once then stops
C. Executes only if the expression is true
D. Loops infinitely by default



19. A method is:
A. A variable in a class
B. A member of a class that defines an operation on an object
C. A type of constructor
D. A static class



20. Calling a method within the same class using methodName() is equivalent to:
A. this.methodName()
B. super.methodName()
C. ClassName.methodName()
D. methodName(); (no difference)



21. Difference between public and private instance variables:
A. Public accessible only inside the class
B. Private accessible outside the class
C. Public accessible outside; private accessible only inside
D. No difference




Page 4 of 43 3/21/2026, 6:54:41 PM

Información del documento

Subido en
22 de marzo de 2026
Número de páginas
43
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$18.49

¿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.
AnswersCOM
3.6
(235)
Vendido
1408
Seguidores
355
Artículos
27175
Última venta
1 día 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