Python Round 4

Quiz
•
Computers
•
University
•
Hard
Noor Malik
FREE Resource
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
What is the time complexity of the following C code snippet?
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
printf("%d, %d\n", i, j);
}
}
O(n)
O(n log n)
O(n^2)
O(2^n)
2.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
In a C++ program, if you have a loop that iterates through an array of size 'n' and performs a constant number of operations inside the loop, what is the time complexity of this operation?
O(1)
O(n)
O(log n)
O(n^2)
3.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Consider the following C++ code snippet:
cpp
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
// Constant time operations
}
}
What is the time complexity of this code snippet?
O(n)
O(m)
O(n + m)
O(n * m)
4.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
You need to store a potentially very large number of records, with data being added as it arrives. You must retrieve a record by its primary key, which arrives randomly. Records may be deleted randomly, and all modifications need to be completed promptly after submission. The dataset size is unknown, and the implementation needs to be ready in a few weeks. Who is designing the program, but a co-op student will do the programming.
Which data structure would be most suitable for this scenario?
Ordered array
Heap
Hash table
Binary search tree
Unordered
5.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
You need to store a potentially very large number of records, with data being added as it arrives. You must retrieve a record by its primary key, which arrives randomly. Records may be deleted randomly, and all modifications need to be completed promptly after submission. The dataset size is unknown, and the implementation needs to be ready in a few weeks. Who is designing the program, but a co-op student will do the programming.
Which data structure would be most suitable for this scenario?
Unordered
Ordered array
Heap
Hash table
Binary seach tree
6.
OPEN ENDED QUESTION
2 mins • 3 pts
Optimize the given code using for loop instead of if else :-
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
num = 5
result = factorial(num)
print(f"Factorial of {num} is: {result}")
Evaluate responses using AI:
OFF
7.
OPEN ENDED QUESTION
3 mins • 3 pts
Optimize the given code using for loop instead of if else :-
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
num = 5
result = factorial(num)
print(f"Factorial of {num} is: {result}")
Evaluate responses using AI:
OFF
Similar Resources on Wayground
9 questions
Números Binários - Hexadecimal

Quiz
•
University
7 questions
Programación I Práctica 1

Quiz
•
University
12 questions
Enumeration and Recursion

Quiz
•
11th Grade - University
10 questions
Analysis of Algorithms

Quiz
•
University
10 questions
PAA - Análise Assintótica

Quiz
•
University
10 questions
DAA Quiz 1

Quiz
•
University
9 questions
Intro-Computação_2.1

Quiz
•
University
10 questions
Quiz Notación

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University