NEW
Font size
WorksheetsPython Function
Total questions: 30
Worksheet time: 15mins
What is the output of the expression?
round(4.5676,2)?
4.5
4.6
4.57
4.56
What is the output of the functions shown below?
divmod(10.5,5)
divmod(2.4,1.2)
(2.00, 0.50)(2.00, 0.00)
(2, 0.5)(2, 0)
(2.0, 0.5)(2.0, 0.0)
(2, 0.5)(2)
What is the output of the function shown below?
hex(15)
f
0xF
0Xf
0xf
What is the output?
d = {"john":40, "peter":45}
d["john"]
40
45
“john”
“peter”
What is the output of the following piece of code?
a={1:"A",2:"B",3:"C"}
print(a.get(1,4))
1
A
4
Invalid syntax for get method
What is the output of the following snippet of code?
total={}
def insert(items):
if items in total:
total[items] += 1
else:
total[items] = 1
insert('Apple')
insert('Ball')
insert('Apple')
print (len(total))
3
1
2
0
What is called when a function is defined inside a class?
Module
Class
Another function
Method
What is called when a function is defined inside a class?
Module
Class
Another function
Method
The break command is used to stop the iteration process in the statement
Perulangan for / while
Percabangan if
Perulangan for do / while
d. Percabangan case of
The built-in range () function is used to do the desired number of repetitions.
The following statement: >>> range (5,10) will produce output
[5, 6, 7, 8, 9, 10]
[6, 7, 8, 9, 10]
[5, 6, 7, 8, 9]
[6, 7, 8, 9]
The raw_input function is used for..
receive input data from the user through the keyboard with integer data types
receive input data from the user through a keyboard with a string data type
receive input data from the user through the keyboard with the float data type
it's all true
The command used to handle exceptions (handling exceptions) in Python is
try catch
try except
case of
try else
Abbreviation for IDLE?
Indigenous Development Lab
Integrated Development Environment
Integrated Developers Local Environment
Indie Developers Environment
Results from the Statment below..
a = [(x, y)
for x in [0, 3, 5]
for y in [5, 4, 0]
if x!=y]
print(a)
[(0, 5), (0, 4), (3, 5), (3, 4), (3, 0), (5, 4), (5, 0)]
[(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)]
[(0, 3, 5), (0, 4, 5)]
[(0, 5), (0, 4), (0, 0), (3, 5), (3, 4), (3, 0), (5, 5), (5, 4), (5, 0)]
The function used to find the desired information by matching the desired information with the available information is ...
sorting
search
pivot
filtering
The results of the program below are ...
jumlah =[1,2,3,4,5,6,7,8,9]
print(jumlah[-5])
6
5
7
2
What will be the output after the following statement?
a = list (range (10, -10,3))
print (sum (a))
0
10
18
5
The output from the script below is ...
def abc (world):
print ('hello% s'% world) abc ('Python')
Hello world
Hello Python
All answers are missing due to an error
Hello python world
One of the most important programming concepts is the ability to group several lines of code into a unit that can be included in a program that is commonly called ...
decomposition
runtime system
sub-programs
typical error
What is the default return value for a function that does not return any value explicitly?
None
int
double
public
Which of the following items are present in the function header?
function name
function name and parameter list
parameter list
return value
Which of the following keywords marks the beginning of the function block?
fun
define
def
function
What is the name given to that area of memory, where the system stores the parameters and local variables of a function call?
a heap
storage area
a stack
an array
Which of the following statements correctly represent the function body in the given code snippet?
def f(number):
# Missing function body
print(f(5))
return “number”
print(number)
print(“number”)
return number
What is the output of the following code snippet?
def myfunc(text, num):
while num > 0:
print(text)
num = num - 1
myfunc('Hello', 4)
HelloHelloHelloHelloHello
HelloHelloHelloHello
invalid call
infinite loop
Which of the following would you relate to a function call made with an argument passed as its parameter?
function invocation
pass by value
pass by reference
pass by name
What is the output of the following code snippet?
num = 1
def func():
num = 3
print(num)
func()
print(num)
1 3
3 1
The program has a runtime error because x is not defined.
1 1
Proses berpikir manusia umumnya melewati 2 tahap, adalah….
Instrospection dan pshycological experiment
Instrospection dan penalaran komputasi
penalaran komputasi dan pshycological experiment
smart robotica dan Acting Rationally
Suatu fungsi dengan tipe ini akan memberikan kembalian/return berupa nilai bertipe….
header
integer
library
alphanumeric
Sebuah sistem informasi yang memiliki intelegensia buatan (Artificial Intelegent) yang menyerupai intelegensia manusia disebut….
Decision Support System
Extra Sensory Project
program ELIZA
Expert System
