CS 3304 FINAL EXAM | QUESTIONS AND ANSWERS | 2026 UPDATE | 100% CORRECT - UNIVERSITY OF THE PEOPLE.
Time left 1:55:20
Question 1
Answer saved
Marked out of 1.00
Whatis the worst-case order of complexity for an algorithm that does the following: Finding the rst occurrence of a given targetin an
integer array.
Select one:
@ a. O(n)
“b. Oflog n)
“¢. O(nlogn)
~d. on?)
Clear my choice
Question 2
Answer saved
Marked out of 1.00
Consider: A farmer can plant up to 20 acres of land with wheat and barley. He can eam $8,000 for every acre he plants with wheat and
$5,000 for every acre he plants with barley. His use of a necessary pesticide is limited by federal regulations to 10 gallons for his entire
20 acres. Wheat requires 2 gallons of pesticide for every acre planted and barley requires just 1 gallon per acre.
Problem: What is the maximum pro t he can make?
Assumptions:
letx = the number of acres of wheat
lety = the number of acres of barley
Which of the following is a valid constraint for this problem?
Select one:
@ a. y<=10-2x
“ b, x<=0
e x<=10-x
“d. y<=20-2x
Clear my choice
114
, Question 3
Answer saved
Marked out of 1.00
Ina linear programming
problem, what does this point
represent
Select one:
The optimal solution
" b. Aninfeasible solution
¢ AnAlternate vertex
d. None of these answers
Clear my choice
Question 4
Answer saved
Marked out of 1.00
Whatis the running time of the following algorithm (in the worst case) expressed in terms of n?
fori 1ton
doif Alil =x
then retumnii
elseif A[i] < x
theni i+1
else retum “x not found”
return “x not found”
Select one:
Clear my choice
Time left 1:55:20
Question 1
Answer saved
Marked out of 1.00
Whatis the worst-case order of complexity for an algorithm that does the following: Finding the rst occurrence of a given targetin an
integer array.
Select one:
@ a. O(n)
“b. Oflog n)
“¢. O(nlogn)
~d. on?)
Clear my choice
Question 2
Answer saved
Marked out of 1.00
Consider: A farmer can plant up to 20 acres of land with wheat and barley. He can eam $8,000 for every acre he plants with wheat and
$5,000 for every acre he plants with barley. His use of a necessary pesticide is limited by federal regulations to 10 gallons for his entire
20 acres. Wheat requires 2 gallons of pesticide for every acre planted and barley requires just 1 gallon per acre.
Problem: What is the maximum pro t he can make?
Assumptions:
letx = the number of acres of wheat
lety = the number of acres of barley
Which of the following is a valid constraint for this problem?
Select one:
@ a. y<=10-2x
“ b, x<=0
e x<=10-x
“d. y<=20-2x
Clear my choice
114
, Question 3
Answer saved
Marked out of 1.00
Ina linear programming
problem, what does this point
represent
Select one:
The optimal solution
" b. Aninfeasible solution
¢ AnAlternate vertex
d. None of these answers
Clear my choice
Question 4
Answer saved
Marked out of 1.00
Whatis the running time of the following algorithm (in the worst case) expressed in terms of n?
fori 1ton
doif Alil =x
then retumnii
elseif A[i] < x
theni i+1
else retum “x not found”
return “x not found”
Select one:
Clear my choice