100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Summary

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

Rating
-
Sold
-
Pages
20
Uploaded on
11-10-2024
Written in
2021/2022

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

Institution
Course

Content preview

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.

Written for

Institution
Study
Course

Document information

Uploaded on
October 11, 2024
Number of pages
20
Written in
2021/2022
Type
SUMMARY

Subjects

$8.56
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
liekesanders

Also available in package deal

Get to know the seller

Seller avatar
liekesanders Technische Universiteit Delft
Follow You need to be logged in order to follow users or courses
Sold
3
Member since
1 year
Number of followers
0
Documents
11
Last sold
9 months ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions