CSIT-112 Final Study Guide
32 Questions
5 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What type of relationship does proper inheritance create?

  • Is-A (correct)
  • Has-A
  • Belongs-To
  • Part-Of

What is an abstract method?

  • A method that can’t be overridden
  • A method that has at least one parameter
  • A method with a body that performs a function
  • A method that is declared without an implementation (correct)

What does polymorphism allow us to define?

  • Constructor methods for every class
  • One interface with different implementations (correct)
  • A method that must always be public
  • Multiple classes with the same name

What is the first step in the selection sort strategy?

<p>Find the smallest value (B)</p> Signup and view all the answers

What does the compareTo method return if input1 is greater than input2?

<ul> <li>(D)</li> </ul> Signup and view all the answers

What best defines a search pool?

<p>A group of items available for searching (D)</p> Signup and view all the answers

What is the purpose of an abstract class?

<p>To represent general concepts shared by derived classes (D)</p> Signup and view all the answers

What is a defining characteristic of a derived class?

<p>It can have additional features not present in the parent class (B)</p> Signup and view all the answers

What is the purpose of a try-catch statement in a program?

<p>To handle exceptions that may occur during program execution (D)</p> Signup and view all the answers

What does each line in a call stack trace represent?

<p>The sequence of method calls leading to the exception (D)</p> Signup and view all the answers

What is exception propagation in programming?

<p>When an exception moves down the call stack if not caught (C)</p> Signup and view all the answers

What is the base case in recursion?

<p>The condition that allows recursion to terminate (A)</p> Signup and view all the answers

What do the streams System.in, System.out, and System.err represent?

<p>User inputs, program outputs, and error messages, respectively (C)</p> Signup and view all the answers

What happens if a recursive function lacks a base case?

<p>It will result in infinite recursion (D)</p> Signup and view all the answers

What is the main difference between direct recursion and indirect recursion?

<p>Direct recursion calls itself, indirect recursion requires another method (A)</p> Signup and view all the answers

Which of the following is an example of a situation that may cause an exception in a program?

<p>Attempting to access a negative index in an array (D)</p> Signup and view all the answers

What characterizes a stable sorting algorithm?

<p>The original order of equal elements is preserved. (C)</p> Signup and view all the answers

Which of the following is a key feature of a dynamic data structure?

<p>It can grow and shrink as needed. (D)</p> Signup and view all the answers

Which of the following is a characteristic of a stack data structure?

<p>Elements are added and removed from the same end. (D)</p> Signup and view all the answers

What does the 'top' function in a stack do?

<p>Retrieves the top item without removing it. (A)</p> Signup and view all the answers

How are nodes structured in a doubly linked list compared to a singly linked list?

<p>A doubly linked list uses two pointers: next and prev. (B)</p> Signup and view all the answers

What is a collection in the context of data structures?

<p>An object that serves as a repository for other objects. (C)</p> Signup and view all the answers

What does 'push' do in a stack?

<p>Adds an item to the top of the stack. (B)</p> Signup and view all the answers

Which of the following is NOT a type of data structure that can be created using references?

<p>Arrays (B)</p> Signup and view all the answers

What distinguishes the insertion and deletion operations in a queue?

<p>Insertion is done at the rear, deletion at the front. (A)</p> Signup and view all the answers

What is a characteristic of a binary tree?

<p>Each node can have no more than two child nodes. (D)</p> Signup and view all the answers

Which of the following best describes a lambda function?

<p>An unnamed short block of code that returns a value. (D)</p> Signup and view all the answers

What is the difference between a directed graph and an undirected graph?

<p>Directed graphs have arrows to indicate direction, while undirected graphs do not. (B)</p> Signup and view all the answers

Which of the following is a valid method to retrieve a value from a map using a key?

<p>.get() (A)</p> Signup and view all the answers

What are the two common types of graphs?

<p>Directed and Undirected (D)</p> Signup and view all the answers

Which statement is true regarding the attributes of a tree?

<p>Each tree has edges and children connected to a root. (D)</p> Signup and view all the answers

What does the policy FIFO stand for in relation to queues?

<p>First In, First Out (D)</p> Signup and view all the answers

Flashcards

Inheritance

A fundamental object-oriented design technique used to create and organize reusable classes. It allows a new class to inherit properties and methods from an existing class.

Parent Class

The original class from which other classes inherit properties and methods.

Derived Class

The class that inherits properties and methods from the parent class.

Abstract Method

A method declared without a body. It's a placeholder that derived classes must implement.

Signup and view all the flashcards

Abstract Class

A class that cannot be instantiated directly. It acts as a template for derived classes that implement its abstract methods.

Signup and view all the flashcards

Polymorphism

The ability of an object to respond to a method call based on its actual type at runtime.

Signup and view all the flashcards

compareTo method

A method that compares two objects and returns a value indicating their relative order.

Signup and view all the flashcards

Sorting

A process of arranging items in a specific order (ascending or descending).

Signup and view all the flashcards

What is a collection?

A data structure that holds and manages other objects.

Signup and view all the flashcards

What is stable sorting?

A type of sorting that ensures elements with the same value maintain their relative order in the output.

Signup and view all the flashcards

What is unstable sorting?

A type of sorting where the original order of elements with the same value may change.

Signup and view all the flashcards

What is a static data structure?

A data structure with a fixed size.

Signup and view all the flashcards

What is a dynamic data structure?

A data structure that can grow or shrink as needed.

Signup and view all the flashcards

What is a reference (pointer)?

A pointer used to connect or link objects in a dynamic data structure.

Signup and view all the flashcards

What is a linked list?

A linear data structure where elements are arranged in a sequence, connected by pointers.

Signup and view all the flashcards

What is a stack?

A data structure that follows the Last In First Out (LIFO) principle for insertion and removal.

Signup and view all the flashcards

Exception

Represents problems or unusual situations that might occur during program execution.

Signup and view all the flashcards

Call Stack Trace

A record that shows the sequence of method calls and their corresponding line numbers that led to an exception.

Signup and view all the flashcards

Try-Catch Statement

A block of code used to handle potential exceptions. The 'try' block encloses the code that may throw an exception, and the 'catch' block handles it if it occurs.

Signup and view all the flashcards

Exception Propagation

The process of passing an uncaught exception from one method to the next in the call stack until it's caught.

Signup and view all the flashcards

Throwable Class

A class that represents all exceptions in Java. It provides the "throw" keyword, allowing you to explicitly raise exceptions.

Signup and view all the flashcards

System.in, System.out, and System.err

The standard input, output, and error streams in Java. These provide basic ways to interact with the console.

Signup and view all the flashcards

Recursion

A programming technique where a function calls itself within its definition, breaking down a problem into smaller, self-similar subproblems.

Signup and view all the flashcards

Base Case

The condition that stops the recursive process, preventing infinite recursion, and allowing the recursion to unwind.

Signup and view all the flashcards

Queue

A linear data structure where elements are added to the rear and removed from the front, following the First In First Out (FIFO) principle.

Signup and view all the flashcards

Enqueue

The operation used to add an element to the rear of the queue.

Signup and view all the flashcards

Dequeue

The operation used to remove and return the element at the front of the queue.

Signup and view all the flashcards

Tree

A non-linear data structure with nodes connected by edges, forming a hierarchical structure.

Signup and view all the flashcards

Binary Tree

A tree where each node can have at most two child nodes.

Signup and view all the flashcards

Graph

A non-linear data structure without a defined root, where nodes are connected by edges.

Signup and view all the flashcards

Map

A data structure that maps keys to their corresponding values, providing efficient retrieval based on the key.

Signup and view all the flashcards

TreeMap

A data structure that implements a map using a tree structure, typically a self-balancing binary search tree.

Signup and view all the flashcards

Study Notes

CSIT-112 Final Study Guide

  • This final exam covers the entire course, with a focus on the second half.
  • Review all course concepts.

Lecture 1

  • Inheritance: A fundamental object-oriented technique for creating reusable classes.
  • Original Class References: Parent, Super, Base
  • Derived Class References: Child, Subclass
  • Inheritance Relationship: Is-A

Lecture 2

  • Transitive Inheritance: A subclass inherits properties from its top-level class (if applicable).
  • Abstract Method: A method declared but with no implementation (a method header)
  • Abstract Class: Represents a general concept shared by derived classes.

Lecture 4

  • Polymorphism: Defines one interface that can have multiple implementations.
  • Polymorphic Reference: Can change behavior of the method that uses it.

Lecture 5

  • Sorting: Arranging items in a specific order.
  • Selection Sort Strategy: Finds the smallest item, switches it to the first position, next smallest to position 2, repeating until all are in order

Lecture 6

  • compareTo Method: Compares two inputs against each other; returning a value that reflects the relationship between the two inputs.
  • compareTo Return Values:
    • input1 < input2: negative value
    • input1 == input2: 0
    • input1 > input2: positive value
  • Insertion Sort Strategy: Reorganizes the elements progressively to place each element in the correct sorted position.

Lecture 7

  • Search Pool: A group of items.

Lecture 8

  • Exceptions: Problems/unusual situations occurring in a program (not an error)
  • Exception Scenarios: Errors like dividing by zero, unable to read a file, or an out-of-bounds array index.
  • Call Stack Trace: Displays the method call order leading to the exception, including the method, file, and line number of the error.

Lecture 9

  • Exception Propagation: An exception thrown from a method propagates (is passed) to higher-level methods in a call stack until it's caught/handled.
  • Throwable Class: A class used in error handling to provide access to an exception. The throw keyword is related to this.

Lecture 10

  • Standard I/O Streams: System.in, System.out, System.err.
  • System.in: Represents the keyboard input.
  • System.out: Represents the standard output.
  • System.err: Represents error output.

Lecture 11

  • Recursion: Defining something in terms of itself repeatedly until a base case is reached
  • Base Case: A condition that ends the recursive process.
  • Recursive Problems: Examples of problems solved by recursion covered in the course

Lecture 12

  • Direct Recursion: A method that calls itself directly.
  • Indirect Recursion: Multiple methods calling each other.

Lecture 13

  • Collection: An object holding other objects.
  • Stable Sort: Maintains the relative order of equal elements.
  • Unstable Sort: Doesn’t guarantee the relative order of equal elements.
  • Abstract Data Type (ADT): Defined by the operations that can be performed on it and not by its implementation. Fixed size.
  • Dynamic Data Structure: Size can change (grow or shrink) as needed. 
  • References (Pointers): Used to link objects in dynamic structures.
  • Linked Lists: Dynamic linear data structures using nodes connected by references.
  • Graphs: Non-linear structures consisting of nodes (vertices) and edges.

Lecture 14

  • Stack: A linear data structure where the last item added is the first item removed (LIFO).
  • Enqueue/Dequeue: Operations for inserting and removing from a queue (FIFO).
  • Linked List Operations: Insert, Delete, Search of a linked list.
  • Stacks Compared to Arrays

Lecture 15

  • Trees and Graphs: Non-linear Data structures
  • Types of Trees: Binary Trees; where all have nodes with a maximum degree of two; Leaf Nodes(no children)

Lecture 16

  • Maps: Data structures that store key-value pairs.  
  • Map Implementations: TreeMap, HashMap
  • Key-Value Pairs: Unique identifier associated with a data value.
  • Lambda Expressions: Anonymous function definitions often used in collections processing (parameters, ->, body).

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

CSIT-112 Final Study Guide PDF

Description

Prepare for your CSIT-112 final exam with this comprehensive study guide. Focus on key concepts such as inheritance, polymorphism, and sorting algorithms, drawn from the entire course material, particularly the second half. Review essential definitions and techniques to ensure you're well-prepared for the exam.

More Like This

Use Quizgecko on...
Browser
Browser