Milking Minds 2 17-01-24
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Vighnesh Nicham
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the time complexity of the following code snippet in C?
#include <stdio.h>
#include <string.h>
void solve() {
char s[] = "scaler";
int n = strlen(s);
for (int i = 0; i < n; i++) {
s[n + i] = s[i];
}
s[n * 2] = '\0'; // Adding null terminator to form a valid string
printf("%s\n", s);
}
int main() {
solve();
return 0;
}
O(n)
O(n^2)
O(1)
O(log n)
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What happens if the following C statement is compiled and executed?
#include <stdlib.h>
int main() {
int *ptr = NULL;
free(ptr);
return 0; }
The program is not semantically correct
The program is compiled and executed successfully
The program gives a compile-time error
The program compiled successfully but throws an error during run-time
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the purpose of the following C code?
#include <stdio.h>
int main() {
int i, n = 5;
for (i = 0; i <= n; i++) {
printf("Hello, World!\n");
}
return 0;
}
To print 'Hello, World!' 5 times
To print 'Hello, World!' 6 times
To print 'Hello, World!' 4 times
To print 'Hello, World!' n times
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following Python code
def mystery_function(n):
result = 0
for i in range(1, n + 1):
result += i * i
return result
x = mystery_function(4)
What will be the output of the code?
14
30
1
20
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following Python code snippet:
def mysterious_function(n):
return n if n <= 0 else (n % 10) + mysterious_function(n // 10)
result = mysterious_function(987654321)
print(result)
What will be the output of the code?
45
36
55
45 followed by an error
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following Python code:
def calculate_average(nums):
try:
total = sum(nums)
average = total / len(nums)
return average
except ZeroDivisionError:
return "Cannot calculate average for an empty list"
except TypeError:
return "Invalid data type in the list"
except Exception as e:
return f"An unexpected error occurred: {e}"
result = calculate_average([1, 2, 3, '4', 5])
print(result)
What will be the output of the code?
3.0
TypeError: Invalid data type in the list
An unexpected error occurred: unsupported operand type(s) for +: 'int' and 'str'
Cannot calculate average for an empty list
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following Python code:
def mysterious_list_operations(lst):
return [i for i in range(len(lst)) if lst.pop(0) % 2 == 0]
original_list = [1, 2, 3, 4, 5, 6]
result = mysterious_list_operations(original_list.copy())
print(result)
What will be the output of the code?
[0, 1, 2]
[1, 3, 5]
[2, 4, 6]
[3, 2, 1]
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Visual Basic 2010
Quiz
•
8th Grade - University
10 questions
Round 1: Get to know US :)
Quiz
•
University
10 questions
Ulangan Harian Teknologi WAN Kelas XI Semester Gasal
Quiz
•
University
20 questions
2. Ayo Main Quiz Lagi
Quiz
•
University - Professi...
20 questions
SOFTWARE 7I
Quiz
•
7th Grade - University
11 questions
Quiz Week 5
Quiz
•
University
10 questions
PYTHON BASICS PART 1
Quiz
•
University
15 questions
Pra UAS Algoritma dan Pemrograman Lanjut
Quiz
•
University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
7 questions
Different Types of Energy
Interactive video
•
4th Grade - University
20 questions
Slopes and Slope-Intercept Form
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Biomolecules (Updated)
Interactive video
•
11th Grade - University
20 questions
Winter/Holiday Trivia
Quiz
•
KG - University
10 questions
WINTER WIN Time - ELA - 12/9/2025
Quiz
•
KG - University
7 questions
Human Impact on Resources
Interactive video
•
4th Grade - University
