CMSC 131 Exam 1 (100% Correct)
Object correct answers The principal entities that are manipulated by a Java program Class correct answers A blueprint or template for the structure of an object. The structure around which all Java programs are based. A typical program has many classes. Method correct answers Java's term for a procedure or subroutine. Every method belongs to some class, and a class may have many methods Main Method correct answers There must be exactly one method called main. This is where execution begins. public static void main(String args[]){ //body } Statements correct answers Individual instructions. There are many different types of statements. Each method consists of some number of statements. Declarations correct answers (Ex of statement) Declare (and initialize) variables Assignment correct answers (Ex of statement) Compute and assign a new value to a variable Method invocation correct answers (Ex of statement) Execute a method (which may return a result) Control flow correct answers The order in which statements are executed. General rule is top to bottom. What is Java compiled into? correct answers Java bytecode What do you need to run Java bytecode? correct answers A bytecode interpreter ("Java Virtual Machine") Why is Java more portable than C or C++? correct answers C/C++ programs are compiled into machine code (rather than Java bytecode) and executed directly by CPU. A class consists of a combination of data units, called ___________, and computation units, called ___________. correct answers variables, methods Methods correct answers Where all the computation takes place. Each method has a name, a list of arguments enclosed in parentheses, and body, enclosed in curly braces. Ex: public static void main (String[]args){ //body
Escuela, estudio y materia
- Institución
- CMSC 131
- Grado
- CMSC 131
Información del documento
- Subido en
- 21 de septiembre de 2023
- Número de páginas
- 7
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
Documento también disponible en un lote