CSC 221 Exam 1 Questions and Answers
Three sock types A, B, C exist in a drawer. Pulled socks are kept and not returned. Which is true?
If the first two pulls are different socks, only one more pull is needed for a match
If the first three pulls are different socks, only one more pull is neede...
CSC 221 Exam 1 Questions and Answers
Three sock types A, B, C exist in a drawer. Pulled socks are kept and not returned.
Which is true?
If the first two pulls are different socks, only one more pull is needed for a match
If the first three pulls are different socks, only one more pull is needed for a match
If the first two pulls are different socks, at least two more pulls are needed for a match
If the first three pulls are different socks, at least two more pulls are needed for a match
- answer If the first three pulls are different socks, only one more pull is needed for a
match
Which real-life activity is similar to doing a binary search?
Looking for a matching sock in a drawer full of socks
Looking up Pizza Hut in the phone book
Looking for a house address on a residential street
Looking for a largest number in an unsorted array - answer Looking up Pizza Hut in
the phone book
Which converts a programming language's source code into machine code?
Which programming language is compiled and statically typed, but not object-oriented?
C
C++
Java
Python - answer C
Which programming language is interpreted, dynamically typed, and object-oriented?
C++
HTML
Java
Python - answer Python
Which algorithm solves the problem for finding the minimum of 5 values, such as 3 6 -1
8 4?
, min = first value
for each value
if value < min
min = value
min = first value
for each value
if value > min
min = value
min = first value
for each value
if value == min
min = value
min = first value
for each value
if value < 0
min = value - answer min = first
valuefor each value
if value < min
min = value
Consider the problem of determining the longest word in a list of words with various
lengths. What is the problem input / output?
String value for the longest word / Integer value for the number of words
String value for the longest word / Array of all words
Array of all words / String value for the longest word
Integer value for the number of words / String value for the longest word - answer
Array of all words / String value for the longest word
Which common algorithm should be used to quickly find Pizza Hut in the phone book?
Binary search
Linear search
Longest common substring
Shortest path algorithm - answer Binary search
Which is true if an efficient solution for one NP-complete problem is found?
The algorithm has exponential runtime
There is an efficient algorithm for all other NP-complete problems
Other NP-complete problems are not affected, and don't have efficient algorithms
The al - answer There is an efficient algorithm for all other NP-complete problems
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 Pogba119. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.99. You're not tied to anything after your purchase.