Summary Theory Exam Overview Object-Oriented Programming (OOP) (Now Introduction to Programming)
10 views 0 purchase
Course
Object-Oriented Programming (CSE1100)
Institution
Technische Universiteit Delft (TU Delft)
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
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
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.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller liekesanders. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.37. You're not tied to anything after your purchase.