Object-Oriented Programming Test Preparation - 870 Verified Questions

Page 1


Object-Oriented Programming Test Preparation

Course Introduction

Object-Oriented Programming introduces students to the fundamental concepts and principles of object-oriented design and development. The course covers key topics such as classes, objects, inheritance, encapsulation, and polymorphism, demonstrating how these concepts can be applied to construct flexible, reusable, and maintainable software. Students will explore best practices in structuring complex programs, practice implementing class hierarchies, and gain practical experience working with popular object-oriented programming languages. By the end of the course, learners will be equipped to design and develop robust applications using object-oriented methodologies.

Recommended Textbook

Data Abstraction and Problem Solving with Java Walls and Mirrors 3rd Edition by Janet Prichard

Available Study Resources on Quizplus

15 Chapters

870 Verified Questions

870 Flashcards

Source URL: https://quizplus.com/study-set/2590

2

Chapter 1: Review of Java Fundamentals

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51576

Sample Questions

Q1) A leap year occurs when the year number is divisible by 4.But there is a special case for years ending in 00: these must be divisible by 400 to be considered a leap year.Thus,1900 was not a leap year,but 2000 was.Write an if-statement that determines if the integer variable year represents a leap year.(Hint: use the % operator for taking remainders. )

Answer: if (year % 100 == 0 && year % 400 == 0 || year % 100 != 0 && year % 4 == 0) System.out.println("It's a leap year.");

Q2) What is wrong with this Java statement? int num = new int(5);

Answer: int is a primitive type in Java,not a class.We can immediately assign it the value of 5;there is no constructor to call,and no need to dynamically allocate memory.

Q3) A statement invoking a constructor should also use the Java keyword ______.

A)class

B)return

C)public

D)new

Answer: D

To view all questions and flashcards with answers, click on the resource link above.

Page 3

Chapter 2: Principles of Programming and Software Engineering

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51577

Sample Questions

Q1) Which of the following is NOT used to find logical errors?

A)breakpoints

B)watches

C)System.out.println statements

D)exceptions

Answer: D

Q2) A prototype program is created during the ______ phase of the software life cycle.

A)design

B)specification

C)coding

D)testing

Answer: B

Q3) What are the nine phases of the software life cycle?

Answer:

Specification,design,risk analysis,verification,coding,testing,refining,production,and maintenance.

Q4) What is a mutator method?

Answer: A mutator method is a method that sets a data field's value.

Q5) What is an accessor method?

Answer: An accessor method is a method that returns a data field's value.

To view all questions and flashcards with answers, click on the resource link above. Page 4

Chapter 3: Recursion: the Mirrors

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51578

Sample Questions

Q1) A recursive method that computes the number of groups of k out of n things has the precondition that ______.

A)n is a positive number and k is a nonnegative number

B)n is a nonnegative number and k is a positive number

C)n and k are nonnegative numbers

D)n and k are positive numbers

Answer: C

Q2) Which of the following is a precondition for a method that accepts a number n and computes the nth Fibonacci number?

A)n is a negative integer

B)n is a positive integer

C)n is greater than 1

D)n is an even integer

Answer: B

Q3) What is the base case for the recursive solution to the Towers of Hanoi problem?

Answer: The base case for the recursive solution to the Towers of Hanoi problem is a recursive call that has only one disk to move.

To view all questions and flashcards with answers, click on the resource link above.

Chapter 4: Data Abstraction: The Walls

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51579

Sample Questions

Q1) The specifications of an ADT's operations indicate ______.

A)what the operations do

B)how to implement the operations

C)how to store the data in the ADT

D)how to carry out the operations

Q2) A default Java constructor has a single parameter.

A)True

B)False

Q3) What is the difference between the physical size and the logical size of an array?

Q4) A(n)______ is a class that inherits the members of another class.

A)base class

B)superclass

C)abstract class

D)subclass

Q5) What is a constructor?

Q6) The head of a list does not have a successor.

A)True

B)False

Q7) When is a compiler-generated default constructor created?

To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Linked Lists

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51580

Sample Questions

Q1) When a linked list is empty,the value of the head reference is null.

A)True

B)False

Q2) To delete a node N from a linear linked list,you will need to ______.

A)set the reference next in the node that precedes N to reference the node that follows N

B)set the reference next in the node that precedes N to reference N

C)set the reference next in the node that follows N to reference the node that precedes N

D)set the reference next in N to reference the node that follows N

Q3) In a circular doubly linked list,inserting into the first position of the list is a special case.

A)True

B)False

Q4) A ______ can be used to store global information about a linked list.

A)head record

B)tail reference

C)precede reference

D)dummy head node

Q5) What does a node of a linear linked list contain?

To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: Problem Solving With Abstract Data Types

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51581

Sample Questions

Q1) In a grammar,the symbol x | y means ______.

A)x or y

B)x followed by y

C)x out of y

D)x divided by y

Q2) The symbol means ______.

A)separate

B)concatenate

C)multiply

D)select

Q3) What is the advantage of using prefix or postfix expressions instead of infix expressions?

Q4) The statement: JavaPrograms = {strings w : w is a syntactically correct Java program}

Signifies that ______.

A)all strings are syntactically correct Java programs

B)all syntactically correct Java programs are strings

C)the JavaPrograms language consists of all the possible strings

D)a string is a language

Q5) When is the base case of the Eight Queens problem reached?

To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Stacks

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51582

Sample Questions

Q1) If a stack is used by an algorithm to check for balanced braces,which of the following is true once the end of the string is reached?

A)the stack is empty

B)the stack has one "{"

C)the stack has one "}"

D)the stack has one "{" and one "}"

Q2) Suppose an infix expression contains parentheses as grouping symbols.Is it still possible to convert this expression into postfix notation?

Q3) In the StackInterface class,the push method accepts as its parameter an item that is an instance of ______.

A)Integer

B)Double

C)String

D)Object

Q4) How can the condition,when you reach the end of the string,you have matched each "{",be verified in a program that uses a stack to check for balanced braces?

Q5) What is an activation record?

Q6) What is an exhaustive search?

To view all questions and flashcards with answers, click on the resource link above. Page 9

Chapter 8: Queues

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51583

Sample Questions

Q1) If a queue is implemented as the ADT list,which of the following queue operations can be implemented as list.get(1)?

A)enqueue()

B)dequeue()

C)isEmpty()

D)peek()

Q2) An event list for an event-driven simulation of a bank contains ______.

A)all arrival events

B)all arrival events that will occur but have not occurred yet

C)all departure events

D)all departure events that will occur but have not occurred yet

E)all arrival and departure events that will occur but have not occurred yet

Q3) If an object is inserted into a queue,how soon can it be removed?

Q4) Give an example of a queue that one may find in a computer system.

Q5) Which of the following ADTs is like a line of people?

A)list

B)stack

C)queue

D)tree

Q6) What is an event-driven simulation?

Page 10

To view all questions and flashcards with answers, click on the resource link above.

Chapter 9: Advanced Java Topics

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51584

Sample Questions

Q1) The class which inherits the members of another class is known as the ______.

A)superclass

B)derived class

C)base class

D)abstract class

Q2) A base class is a class that inherits the members of another class.

A)True

B)False

Q3) What is method overloading?

Q4) What is an advantage to defining an ADT that uses a generic data type?

Q5) What is containment?

Q6) What is a subinterface?

Q7) Name 3 important operations that an iterator object can perform.

Q8) A superclass method can be accessed by a subclass,even though it has been overridden by the subclass,by using the ______ reference.

A)super

B)final

C)static

D)new

Q9) What are the two basic kinds of relationships among classes? Page 11

To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 10: Algorithm Efficiency and Sorting

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51585

Sample Questions

Q1) What is determined by average-case analysis?

Q2) Each merge step of the mergesort requires ______ major operations.

A)3 * n - 1

B)4 * n - 1

C)(n - 1)/2

D)n - 1

Q3) A quadratic algorithm has the growth-rate function ______.

A)O(n²)

B)O(n³)

C)O(2 )

D)O(log2 )

Q4) An algorithm's execution time is related to the number of ______ it requires.

A)parameters

B)test data sets

C)data fields

D)operations

Q5) The analysis of an algorithm must take into consideration the computer that will be used to run a program that implements the algorithm.

A)True

B)False

Page 13

To view all questions and flashcards with answers, click on the resource link above.

Chapter 11: Trees

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51586

Sample Questions

Q1) In a binary tree,what is the maximum number of siblings a node may have? What is the minimum?

Q2) Define a leaf of a tree.

Q3) In ______,the left and right subtrees of any node have heights that differ by at most 1.

A)all trees

B)all binary tress

C)n-ary trees

D)balanced binary trees

Q4) The ______ of a tree is the number of nodes on the longest path from the root to a leaf.

A)height

B)length

C)width

D)age

Q5) Suppose we insert these values into a binary search tree: 1,7,2,5,8,3,6.Give a postorder traversal of this tree.

Q6) All trees are hierarchical in nature.

A)True

B)False

Page 14

To view all questions and flashcards with answers, click on the resource link above.

Chapter 12: Tables and Priority Queues

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51587

Sample Questions

Q1) What are the advantages of a linear implementation of the ADT table over a binary search tree implementation?

Q2) The search key of an item must not change for as long as the item is stored in a table.

A)True

B)False

Q3) A(n)______ implementation of a table is nonlinear.

A)list

B)linked list

C)binary search tree

D)array

Q4) In the sorted linear implementation of a table,the proper position of a new item to be inserted is determined ______.

A)by the data type of the item

B)by the size of the item

C)by the value of the item

D)by the value of the search key of the item

Q5) What is the major advantage that a heap implementation of a priority queue has over a binary search tree implementation?

To view all questions and flashcards with answers, click on the resource link above. Page 15

Chapter 13: Advanced Implementations of Tables

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51588

Sample Questions

Q1) What are the two types of approaches for resolving collisions in a hash table design?

Q2) A 4-node is found in a(n)______.

A)AVL tree

B)2-3 tree

C)2-3-4 tree

D)red-black

Q3) A hash table is a(n)______.

A)stack

B)queue

C)array

D)list

Q4) Suppose we have already inserted the values 5,10 and 15 into an empty 2-3-4 tree.Explain what happens when we insert the value 20 into this tree.

Q5) In designing a hash table,why do we want the size of the table to be significantly larger than the maximum number of entries that we will insert into it?

Q6) What are the two types of rotations possible in an AVL tree?

Q7) What is a 2-node?

Q8) What is a disadvantage of a 2-3-4 tree when compared with a binary search tree?

Page 16

To view all questions and flashcards with answers, click on the resource link above.

Chapter 14: Graphs

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

Source URL: https://quizplus.com/quiz/51589

Sample Questions

Q1) A path is a sequence of ______ in a graph.

A)vertices

B)edges

C)subgraphs

D)cycles

Q2) A connected graph has an edge between every pair of vertices.

A)True

B)False

Q3) Two vertices that are joined by an edge are said to be ______ each other.

A)related to

B)bordering

C)utilizing

D)adjacent to

Q4) A subset of a graph's vertices and edges is known as a ______.

A)bar graph

B)line graph

C)subgraph

D)circuit

Q5) What is a simple cycle?

Q6) What is a cycle?

To view all questions and flashcards with answers, click on the resource link above. Page 17

Chapter 15: External Methods

Available Study Resources on Quizplus for this Chatper

30 Verified Questions

30 Flashcards

Source URL: https://quizplus.com/quiz/51590

Sample Questions

Q1) In a B-tree,all leaves must be at the same level.

A)True

B)False

Q2) When we perform external hashing,we hash the data file instead of the index file.

A)True

B)False

Q3) What type of tree is best used for indexing external data?

A)B-tree

B)binary search tree

C)2-3-4 tree

D)AVL tree

Q4) A 2-3 tree is a type of B-tree.

A)True

B)False

Q5) What is the advantage of using a B-tree instead of a 2-3 tree for indexing external data?

Q6) Why is random access preferable over sequential access for supporting external tables?

Q7) Name two advantages to storing a data structure in external storage.

Page 18

To view all questions and flashcards with answers, click on the resource link above.

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.