Font size
WorksheetsSCRIPTING PROGRAMMING WITH PYTHON
Total questions: 15
Worksheet time: 8mins
Which are the composites values for Python?
I. Tuples
II. Dictionaries
III. Lists
IV. Objects
I, II
I, III
I, II, III
I, II, III, IV
Keyword __________ is used to define function in Python.
_init_
self.
def
construct
What is the output from the following Pythons program segment?
x = 2 ** 3 / 2 ** 2
print x
1.5
2
2.25
3
Give the output when the following codes written in Python are compiled.
str1= "saya anak merdeka"
print str1[:10] + 'malaysia'
saya anak malaysia
saya anak merdeka malaysia
saya anakmalaysia
saya anak memalaysia
Which of the data type is NOT supported by Python?
Numbers
String
List
Enum
What do we use to define a block of code in Python language?
Key
Brackets
Indentation
None of these
Which character is used in Python to make a single line comment?
/
//
!
#
What is the subprogram called in Python language?
Object
Function
Method
Parameter
Which of the following operators is the correct option for A power to the B?
A**B
A ^ B
A ^^ B
A ^* B
What will be the output of this function for Python?
round(4.576)
4
5
0.576
4576
Scripting languages are ________ typing languages.
static
compiled
dynamic
behaviour
The code block within every function in Python will start with a _____ and is indented.
:
(
,
{
Codes given below are an example of _____ in Python.
thisLine = ["Code":"CSC305", "Semester":5]
dictionary
list
string
tuple
Which of the following are NOT programming languages that support the scripting paradigm?
PHP
Java
Python
JavaScript
What will be the output of the following Python code?
num_list = [1, 2, 3, 4, 5]
print(num_list[2])
1
2
3
4
