• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 20 páginas
Resumen

Summary Theory Exam Overview Object-Oriented Programming (OOP) (Now Introduction to Programming)

Document preview thumbnail
Vista previa 3 fuera de 20 páginas

Theory Exam Overview (Notes + Exam Questions) Object-Oriented Programming (OOP) (Now Introduction to Programming) Year 1 (2021/2022) Computer Science and Engineering at TU Delft

Vista previa del contenido

NOTES + PRACTICE QUESTIONS FOR THEORY EXAM
OBJECT-ORIENTED PROGRAMMING CSE1100
CSE TU Delft - Lieke Sanders
→ Course is now called Introduction to Programming
→ Includes general notes + explained MC/open/programming questions for the theory exam
(so not the computer exam!)

Index
(Facts stolen from) MC and open questions 2
Primitive vs reference 2
Compilation vs runtime errors 2
Inheritance 2
Arrays 2
Array copies 3
Class design 3
Static 5
Quality 5
== operator 5
Logical operators 6
Switch case 6
Values and pointers 6
Parameter passing 7
Static vs dynamic types 7
Compilation 8
Polymorphism 8
Iteration or recursion 9
Threads 9
Deadlock 9
Cyclomatic complexity 10
Streams 10
Overriding vs overloading 10
Tests 11
Exception tests 12

Programming questions 14
Patterns 14
Control flow 15
Reverse String 16
Capitalize first letter 17
Inheritance 17
Reader 18
Writer 19
Full class 19

,(Facts stolen from) MC and open questions
Primitive vs reference
Primitive Reference

Can not be null Can be null

Store the actual values Store the addresses

int/double/boolean/char/short/float/long/byte object/String/array


Compilation vs runtime errors
Compilation error Runtime error

Will prevent the program from running Will prevent the program from executing

Syntax/semantics Exceptions noticed while running program

Like too many/missing { } + forgetting ; + Like division by 0 (ArithmeticException) +
using a value without declaration NullPointerException


Inheritance
- In Java all classes inherit from the Object class directly or
indirectly. The Object class is root of all classes.
- Multiple inheritance is not allowed in Java.
- A non-abstract child class must override an abstract
method inherited from its parent by defining a method with
the same signature.
- Child classes can override and overload methods defined
in their superclass(es).
- A non-abstract class can not contain abstract methods.

Arrays
- An array is an arrangement of consecutive memory
locations.
- Using an array can lead to an
ArrayIndexOutOfBoundsException.
- An array does not grow automatically when you add elements to it.
- If you pass an array as a parameter, the memory address of that array is copied
rather than the values that are stored in the array.

, Array copies




What will happen if we run the main method?
The program will print true

Class design
1
- There is a non-abstract class Vehicle.
- BMW is a carmaker brand.
- There is more than 1 carmaker brand.
- Every BMW is a Vehicle.
Which of the following design choices is most appropriate?

x You should create a class BMW that inherits from Vehicle.
✓ The Vehicle class should have an attribute indicating the brand.
x There should be a “1 to 1” relationship between Vehicle and BMW.
x There should be a “1 to n” relationship between Vehicle and BMW.

Información del documento

Estudio
Subido en
11 de octubre de 2024
Número de páginas
20
Escrito en
2021/2022
Tipo
Resumen
$8.37

¿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

Vendido
3
Seguidores
0
Artículos
11
Última venta
1 año 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