Skip to main content

Computer Science I Exam Practice Tests - 870 Verified Questions

Page 1


Computer Science I Exam Practice Tests

Course Introduction

Computer Science I is an introductory course that provides students with a foundational understanding of computer programming, problem-solving techniques, and the basic principles of software development. Through hands-on programming assignments, students learn fundamental concepts such as variables, control structures, functions, arrays, and algorithmic thinking using a modern programming language. The course emphasizes logical reasoning, program structure, and debugging skills, preparing students for more advanced topics in computer science and equipping them with essential tools for computational problem-solving.

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 Page 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) Suppose a,b and c are the lengths of the 3 sides of a triangle.Write an if-statement that will determine if the triangle is isosceles (at least 2 of the 3 sides are equal).You may assume that a,b and c are of type int.

Answer: if (a == b || a == c || b == c)

System.out.println("isosceles triangle");

Q2) If an int is added to a float,the result will be an int.

A)True

B)False

Answer: False

Q3) In Java,how do we tell the compiler that the body of a loop consists of several statements,rather than one?

A)We enter all the statements on the same line

B)We indent all the statements at the same level of indentation

C)We enclose the statements in curly braces

D)We insert a break statement at the end of the loop

Answer: C

Q4) If s = "hello,world" (with exactly one space between the comma and 'w'),what does s.indexOf(",")return?

Answer: 5

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) Object-oriented design identifies objects by focusing on the ______ in the problem statement.

A)nouns

B)verbs

C)adjectives

D)adverbs

Answer: A

Q2) A top-down design identifies actions by focusing on the ______ in the problem statement.

A)nouns

B)verbs

C)adjectives

D)adverbs

Answer: B

Q3) A set of objects that have the same type is called a(n)______.

A)data structure

B)abstract data type

C)module

D)class

Answer: D

Page 4

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

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) What is a base case?

Answer: A base case is a special case of a recursive solution that terminates the recursive processing.

Q2) Which of the following is a base case for a recursive binary search algorithm? (first is the index of the first item in the array,last is the index of the last item in the array,and mid is the midpoint of the array).

A)last > first

B)first > last

C)0 <= first

D)last <= SIZE-1

Answer: B

Q3) How many bases cases will be required in a recursive solution that solves a problem by solving two smaller problems of the same type?

A)0

B)1

C)2

D)3

Answer: C

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

5

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) In Java,a class can extend ______.

A)at most 1 class

B)at most 16 classes

C)at most 32 classes

D)as many classes as required

Q3) In the following list: John,Kate,Fred,Mark,Jon,Adam,Drew

Which element does not have a predecessor?

A)John

B)Mark

C)Drew

D)Kate

Q4) How do checked exceptions and runtime exceptions differ in the way that they are handled?

Q5) What is a data structure?

Q6) What is an abstract data type (ADT)?

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) In a reference-based implementation of an ADT list ______.

A)increasing the size of the list can waste storage and time

B)less memory is required to store an item than in an array-based implementation

C)an item explicitly references the next item

D)the location of the item after a particular item is implied

Q2) Which of the following exceptions can be thrown if an object cannot be instantiated?

A)IllegalAccessException

B)ArithmeticException

C)IndexOutOfBoundsException

D)NoSuchMethodException

Q3) In the following code segment: final int SIZE = 20;// line 1

Int groupSize;// line 2

GroupSize = SIZE;// line 3

GroupSize = groupSize * 2;// line 4

What is the value of groupSize in line 2?

A)0

B)null

C)20

D)40

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) Which of the following is a postfix expression?

A)/ a + b c

B)a b c + /

C)* a b c / +

D)a / (b +c)

Q2) The symbol means ______.

A)separate

B)concatenate

C)multiply

D)select

Q3) Which of the following is the postfix form of the prefix expression: * + a b c?

A)a + b * c

B)a + b c *

C)a b + c *

D)a b * c +

Q4) Which of the following strings is a palindrome?

A)"bottle"

B)"beep"

C)"coco"

D)"r"

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) 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?

Q2) What is the value of the following postfix expression: 5 2 - 8 4 + *?

A)-9

B)28

C)35

D)36

Q3) What is a directed path?

Q4) What is an activation record?

Q5) 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 "}"

Q6) If a stack is used in a nonrecursive solution to the HPAir problem,when is it necessary to backtrack from a city?

Q7) What is the difference between the stack pop and peek operations?

Page 9

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

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) What is the difference between an external event and an internal event?

Q2) The addition of an item to an empty queue is a special case.

A)True

B)False

Q3) Which of the following is true about a time-driven simulation of a bank?

A)arrival times are obtained from an input file

B)transaction times are obtained from an input file

C)currentTime is incremented by 1 to simulate the ticking of a clock

D)no action is required between events

Q4) In an event-driven simulation of a bank,which of the following equations can be used to determine the time of a customer's departure?

A)time of next departure = current time - arrival time

B)time of next departure = time service begins + length of transaction

C)time of next departure = arrival time + length of transaction

D)time of next departure = current time - (arrival time + time service begins)

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

A)list

B)stack

C)queue

D)tree

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) ______ is the ability of a variable name to represent,during program execution,instances of different but related classes that descend from a common superclass.

A)Inheritance

B)Containment

C)Polymorphism

D)Encapsulation

Q2) A(n)______ is a class that is used to provide access to another class that contains many objects.

A)interface

B)abstract class

C)package

D)iterator

Q3) Clients of a class can directly access the protected members of that class.

A)True

B)False

Q4) What is method overloading?

Q5) What is containment?

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

Q7) What is a subinterface?

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

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) The values of the growth-rate function O(log2 )grow faster than the values of the growth-rate function O(n).

A)True

B)False

Q2) Algorithm efficiency is typically a concern for ______.

A)small problems only

B)large problems only

C)medium sized problems only

D)problems of all sizes

Q3) The ______ compares adjacent items and exchanges them if they are out of order.

A)selection sort

B)binary search

C)bubble sort

D)quicksort

Q4) What is determined by worst-case analysis?

Q5) What is determined by average-case analysis?

Q6) What measurements are parts of a program's efficiency?

Q7) In the worst case,how many comparisons are required in the bubble sort?

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

Q8) When choosing between two algorithms,under what conditions can the efficiencies of the algorithms be ignored?

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) What are the three properties of each node n in a binary search tree?

Q2) The minimum height of a binary tree of n nodes is ______.

A)n

B)n / 2

C)(n / 2)- 2

D)log2(n + 1)

Q3) The traversal of a binary tree is ______.

A)O(n)

B)O(1)

C)O(n²)

D)O(log2 )

Q4) The array based representation of a binary tree requires a complete binary tree.

A)True

B)False

Q5) A ______ of height h is full down to level h - 1,with level h filled in from left to right.

A)full binary tree

B)complete binary tree

C)balanced binary tree

D)general tree

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

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) In an unsorted array-based implementation of the ADT table,the retrieval operation is ______.

A)O(1)

B)O(n)

C)O(n²)

D)O(log n)

Q2) In an unsorted reference-based implementation of a table,the tableInsert operation requires a constant time regardless of the table size.

A)True

B)False

Q3) In an unsorted array-based implementation of the ADT table,the insertion operation is ______.

A)O(1)

B)O(n)

C)O(n²)

D)O(log n)

Q4) The Java Collections Framework includes classes called maps such as HashMap and TreeMap.In such classes,the individual elements each have two attributes.What are they?

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

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) A 3-node contains three data items.

A)True

B)False

Q2) The maximum height of a binary search tree of n nodes is ______.

A)n

B)n - 1

C)n / 2

D)log2(n + 1)

Q3) What is the advantage of using a variation of a binary search tree,such as a 2-3 tree or a 2-3-4 tree,instead of a binary search tree?

Q4) In a 3-node,______.

A)the left child has the largest search key

B)the middle child has smallest search key

C)the middle child has the largest search key

D)the right child has the largest search key

Q5) What is a 2-node?

Q6) 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?

Q7) In a 2-3-4 tree,when is a 4-node split during an insertion operation?

Page 15

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 graph is ______ if each pair of distinct vertices has a path between them.

A)complete

B)disconnected

C)connected

D)full

Q2) How is the depth-first search (DFS)strategy of graph traversal different from the breadth-first search (BFS)strategy?

Q3) Define a path between two vertices.

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) A ______ order is a list of vertices in a directed graph without cycles such that vertex x precedes vertex y if there is a directed edge from x to y in the graph.

A)graphical

B)topological

C)hierarchal

D)spatial

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

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 binary search tree,if a node has two children,then how many key values does the node itself contain?

A)none

B)one

C)two

D)the number may vary

Q2) In the external mergesort algorithm,how many buffers are needed to merge runs?

A)one

B)two

C)three

D)four

Q3) An index file consists of index records.An index records consists of two parts: a key and a ______.

A)hash value

B)node

C)pointer

D)value

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

Q5) What is the maximum number of nodes in a B tree of height 3 and degree 10?

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

Turn static files into dynamic content formats.

Create a flipbook
Computer Science I Exam Practice Tests - 870 Verified Questions by Quizplus - Issuu