You are on page 1of 5

9/15/2019 Entrance Test - Python

Which of the following code would best simulate a roll of one dice?

Select one:
a. x=np.random.shuffle(np.arange(1,7))
b. x=np.random.choice(np.arange(1,7))
c. x=np.random.rand(np.arange(1,7))
d. x=np.random.randn(np.arange(1,7))

Question 2
Not yet answered
Marked out of 1.00

Choose from the following expressions to make a dictionary variable, en2id, that contains mappings from English
words to their Indonesian equivalents.
Use these words: chair is kursi, table is meja, and cellphone is ponsel.

Select one:
a. en2id = print(’chair’: ’kursi’, ’table’ : ’meja’, ’cellphone’: ’ponsel’)
b. en2id = {‘chair’, ‘table’, ‘cellphone’ : ‘kursi’, ‘meja’, ‘ponsel’}
c. en2id = (’chair’: ’kursi’) + (’table’: ’meja’) + (’cellphone’: ’ponsel’)
d. en2id = {’chair’: ’kursi’, ’table’: ’meja’, ’cellphone’: ’ponsel’}

Question 3
Not yet answered
Marked out of 1.00

Given the list below


my_list = [ 1, 2, A, B, 3, 4, 5, 6, 7 ]
Remove the letters from the list above!

Select one:
a. del(my_list[2]) ; del(my_list[3])
b. del(my_list[A]) ; del(my_list[B])
c. del(my_list[2:4])
d. del(my_list[A, B])

https://www.iykra.com/mod/quiz/attempt.php?attempt=4279 1/5
9/15/2019 Entrance Test - Python

Question 4
Not yet answered
Marked out of 1.00

Use df dataframe below for question :

Shown below is a subset of df dataframe. What's the possible function to perform the subset?

Select one:
a. df.loc[['R1','R2'],['C1','C2']]
b. df.loc[('R1','R2'),('C1','C2')]
c. df[['R1','R2'],['C1','C2']]
d. All corrrect

https://www.iykra.com/mod/quiz/attempt.php?attempt=4279 2/5
9/15/2019 Entrance Test - Python

Question 5
Not yet answered
Marked out of 1.00

Use df dataframe below

Let's say you want to drop the last row (R4). What's the possible function?

Select one:
a. df.drop(['R4'],axis=3)
b. df.drop('R4',axis=0)
c. df.drop('R4',axis=1)
d. df.drop('R3,axis=0')

Question 6
Not yet answered
Marked out of 1.00

The output of this Python code is the string s backwards.

What goes in the spot marked XXXXX?

Select one:
a. ch
b. s
c. t + ch
d. ch + t

https://www.iykra.com/mod/quiz/attempt.php?attempt=4279 3/5
9/15/2019 Entrance Test - Python

Question 7
Not yet answered
Marked out of 1.00

id_mat is an identitiy matrix as shown below. What's the possible function if you want to keep onlyu the top 2 rows?

Select one:
a. id_mat[:1,:]
b. id_mat[:2,:]
c. id_mat[0:1,:]
d. id_mat[1:2,:]

Question 8
Not yet answered
Marked out of 1.00

What do we call the optimization heuristic that involves iteratively checking to see if neighboring solutions improve
upon the current solution?

Select one:
a. Local optimum
b. Brute-force search
c. Hill climbing
d. Random search

https://www.iykra.com/mod/quiz/attempt.php?attempt=4279 4/5
9/15/2019 Entrance Test - Python

Question 9
Not yet answered
Marked out of 1.00

checkpassword is a function that takes an integer argument as a password.


It returns True if the integer password is correct and False if the integer password is wrong.
Consider the following code:
MAXPASSWD = 12345
i=0
while i < MAXPASSWD:
if checkpassword(i):
print ’password is’, i
break
i=i+1
This is an example of a

Select one:
a. greedy algorithm
b. partitioning algorithm
c. brute-force algorithm
d. fuzzing algorithm

Question 10
Not yet answered
Marked out of 1.00

How to calculate the volume of cone below?


(Cone volume formula = 1/3 x \( \pi \) r2 x t)
In(1) = import math as mt
In(2) = r = 0.5
In(3) = t = 2
In(4) = ..............

Select one:
a. V = 1/3*mt.pi*r^2*t
b. V = 1/3*mt.pi*r**2*t
c. V = 1/3*pi*r^2*t
d. V = 1/3*pi*r**2*t

https://www.iykra.com/mod/quiz/attempt.php?attempt=4279 5/5

You might also like