MFAI SOTI Quiz

MFAI SOTI Quiz

12th Grade

20 Qs

quiz-placeholder

Similar activities

Audio Production Basics

Audio Production Basics

8th - 12th Grade

20 Qs

Season 3 #Spaic Machine learning Weekly Quiz

Season 3 #Spaic Machine learning Weekly Quiz

KG - Professional Development

20 Qs

Programming Fundamentals

Programming Fundamentals

KG - University

20 Qs

CODE Unit 3 Intro to App Design 2020-21

CODE Unit 3 Intro to App Design 2020-21

9th - 12th Grade

19 Qs

28.02 C sharp

28.02 C sharp

12th Grade

15 Qs

Flowcharts

Flowcharts

8th Grade - University

23 Qs

1.3 Quiz

1.3 Quiz

8th Grade - University

15 Qs

Big Idea #3 Part 1

Big Idea #3 Part 1

12th Grade

15 Qs

MFAI SOTI Quiz

MFAI SOTI Quiz

Assessment

Quiz

Other

12th Grade

Medium

Created by

MindFul AI

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

3 mins • 5 pts

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.

Example 1:

Input: nums = [2,7,11,15], target = 9

Output: [0,1]

Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].

Which algorithm could be used that is less than O(n²) time complexity?

HashMap/Dictionary 

Brute Force 

Binary Search 

 Two Pointers

2.

MULTIPLE CHOICE QUESTION

3 mins • 5 pts

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

Example 1:

Input: height = [0,1,0,2,1,0,1,3,2,1,2,1]

Output: 6

Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped.

Which algorithm is best suited for this program?

Dynamic Programming 

Brute Force 

Two Pointer Approach 

Monotonic Stack

3.

MULTIPLE CHOICE QUESTION

3 mins • 5 pts

Given a sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [1, n] inclusive can be formed by the sum of some elements in the array. Return the minimum number of patches required.

Example 1:

Input: nums = [1,3], n = 6

Output: 1

Explanation:

Combinations of nums are [1], [3], [1,3], which form possible sums of: 1, 3, 4. Now if we add/patch 2 to nums, the combinations are: [1], [2], [3], [1,3], [2,3], [1,2,3]. Possible sums are 1, 2, 3, 4, 5, 6, which now covers the range [1, 6]. So we only need 1 patch.

What is the best time complexity that you can solve this problem in?

 O(n) 

O(log n) 

O(n²)

O(n log n) 

4.

MULTIPLE CHOICE QUESTION

3 mins • 5 pts

Given a non-negative integer c, decide whether there're two integers a and b such that ( a^2 + b^2 = c)
Example 1:

Input: c = 5

Output: true

Explanation: \( 1^2 + 2^2 = 5 \)

Which is the best time complexity in which you can solve this?

O(sqrt(c)) 

 O(log c) 

O(c) 

O(c log c)

5.

MULTIPLE CHOICE QUESTION

45 sec • 5 pts

Why does Java always produce a lower time complexity than Python?

Python's dynamic typing 

Java's static typing 

Java's garbage collection

JIT Compilation 

6.

MULTIPLE CHOICE QUESTION

45 sec • 5 pts

Which data structure allows storing elements in a sorted order?

Stack 

PriorityQueue 

Queue 

HashMap

7.

MULTIPLE CHOICE QUESTION

45 sec • 5 pts

Which sorting algorithm is best?

BubbleSort 

SelectionSort 

InsertionSort

QuickSort 

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?