WeCP Algorithm Quiz 1

Question 1

Time: 00:00:00
What is the function that can directly convert a binary string s to an integer?

 

int(s,0,2)

int(s,0,2)

stoi(s,0,2)

stoi(s,0,2)

itoa(s,0,2)

itoa(s,0,2)

stoull(s,0,2)

stoull(s,0,2)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Suppose from  a given node I have to find how many connected components are there in a given graph. What is the way to find that out?

DFS

DFS

BFS

BFS

Both

Both

Topological sort

Topological sort

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Heap sort is a sort using :

 

Stack memory

Stack memory

Stack data structure

Stack data structure

Heap memory

Heap memory

Priority queue

Priority queue

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What is a randomised quick sort?

Selecting the pivot element randomly

Selecting the pivot element randomly

Starting from random index

Starting from random index

Changing the pivot number index into random index

Changing the pivot number index into random index

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is the deletion time in an unordered_map with n values?

log(n) + Rebalance time

log(n) + Rebalance time

log(n)

log(n)

O(1)

O(1)

Cannot be determined

Cannot be determined

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Which of this is an implementation of a red black tree?

Hash Table

Hash Table

Map

Map

Unordered_map

Unordered_map

Vector

Vector

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
In a max flow problem what is called the source?

 

 

Centre Vertex

Centre Vertex

Vertex with the maximum weight

Vertex with the maximum weight

Vertex with zero incoming edges

Vertex with zero incoming edges

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Which of the sorting algorithms does not use divide and conquer?

Selection sort

Selection sort

Merge Sort

Merge Sort

Quick Sort

Quick Sort

None of these

None of these

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Suppose you have some boxes, and the one box you open gives you the money that is equal to the weight of the box and the date of the month. In the start you have 30 boxes with given weight, and you have to maximise your profit. What is the best algorithm to implement?

 

Permutation

Permutation

Dynamic Programming

Dynamic Programming

Greedy

Greedy

Divide and Conquer

Divide and Conquer

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
The shortest code inside a function to find how many digit are there in a number n:

 

while(n) s++,n/=10; return s;

while(n) s++,n/=10; return s;

while(n--) s++; return s;

while(n--) s++; return s;

Return to_string(n).length();

Return to_string(n).length();

len(n)

len(n)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%

Comments