Font size
WorksheetsPython Intern
Total questions: 65
Worksheet time: 1hrs 5mins
How to define a list in python ?
my list=[1,2,3]
my_list={1,2,3)
my_list=[1,2,3]
mylist=1,2,3
How to add number 10 to this list?
myList=[1,2,3,4]
myList.append(10)
myList.insert(0,10)
both correct
none of the answers is correct
myList=["ahmed","alaa,"mostafa","Malak","Hajar","leen"]
how to change values ("mostafa","Malak","Hajar") with values
("ahlam","Momen,"asmaa")
PLEASE KEEP SPACE BETWEEN THE TWO LINES THAT YOU WILL WRITE
(a)
How to remove "ahmed" from this list ?
myList=["ahmed","alaa","mostafa","Malak","Hajar","leen"]
myList.delete
("ahmed")
myList.remove
("ahmed")
myList.delete
(0)
myList.remove
(0)
How to sort this list?
myList=[2,5,3,1,4,6]
(a)
x=4
y=4
if x>y:
print("yes")
elif x<y: print("No")
else: print("no condition met")
what will be the output?
yes
no
no condition met
error
firstname="ahlam"
secondname="samir"
if (firstname==secondname):
print("true")
else:
print("false")
true
false
error
secondchar='a'
firstchar='A'
if (secondchar==firstchar):
print("yes")
else:
print("NO")
yes
no
error
What is the name of this symbol (>>>)?
Chevrons
Hash tags
Colon
Semi Colon
What does the following code do? myAge = int (myAge)
Converts the var (variable) myAge to a string
Converts the var (variable) myAge to a integer
Converts the var (variable) myAge from a integer to a string
Converts the var (variable) myAge to if statement
holds whole numbers
holds a decimal point in a number
What is the maximum length of a Python identifier?
32
16
128
No fixed length is specified
What will be the output of the following code snippet?
print(2**3 + (5 + 6)**(1 + 1))
129
8
121
None of the above
What will be the datatype of the var in the below code snippet?
var = 10
print(type(var))
var = "Hello"
print(type(var))
str and int
int and int
str and str
int and str
How is a code block indicated in Python?
Brackets
Indentation
Key
None of the above
What will be the output of the following code snippet?
print(type(5 / 2))
print(type(5 // 2))
float and int
int and float
float and float
int and int
Which of the following concepts is not a part of Python?
Pointers
Loops
Dynamic Typing
All of the above
Which of the following statements are used in Exception Handling in Python?
Try
Except
Finally
All of the above
Which of the following types of loops are not supported in Python?
For
While
Do-While
None of the above
Which of the following is the proper syntax to check if a particular element is present in a list?
If ele in list
If not ele not in list
Both A and B
None of the above
Which of the following functions converts date to corresponding time in Python?
strptime ( )
strftime ( )
Both A and B
None of the above
What will be the output of the following Python function?
len(["hello",2, 4, 6])
6
4
3
Error
Which of the following is a Python tuple?
[1,2,3,4]
{1,2,3,4}
(1,2,3,4)
none of these
To add a new element to a list we use which Python command?
list1.addEnd(5)
list1.add(5)
list1.append(5)
list1.addLast(5)
What will be the output of the following Python expression?
range(5,20,5)
5,10,15
5,10,15,20
5,20,5
5,
What will be the datatype of the var in the below code snippet?
var = 10
print(type(var))
var = "Hello"
print(type(var))
float and str
int and int
str and str
int and str
What will be the output of the following code snippet?
example = ["Sunday", "Monday", "Tuesday", "Wednesday"]
print(example[-3:-1])
"Sunday", "Monday"
"Monday", "Tuesday", "Wednesday"
"Sunday"
"Monday"
"Tuesday"
"Wednesday"
"Monday" "Tuesday"
Which of the following are valid escape sequences in Python?
\n
\\
\t
all of these
What is the output of the following program?
x = 123
for i in x:
print(i)
1 2 3
3
error
none of these
Which of the following words cannot be a variable in python language?
_val
Val
_try_
What will be the output of the following Python code?
a b c d
0 1 2 3
1 2 3 4
none
Study the following program:
i = 1:
while True:
if i%3 == 0:
break
print(i)
Which of the following is the correct output of this program?
1 2 3
1 2
invalid syntax
1 2
Which of the following option is not a core data type in the python language?
List
Dictionary
Class
all of these
What will be the output of the following Python program?
0
0 1 2 3
0 1 2
0 1 2 3 4 5
What happens when '2' == 2 is executed?
No Output
True
False
error
What will be the output of the following Python code?
aBCD
abcd
ABCD
none of these
Which module in Python supports regular expressions?
re
regex
pyregex
What does the function re.match do?
matches a pattern at the start of the string
matches a pattern at any position in the string
such a function does not exist
What will be the output of the following Python code?
sentence = 'we are humans'
matched = re.match(r'(.*) (.*?) (.*)', sentence)
print(matched.groups())
(‘we’, ‘are’, ‘humans’)
(we, are, humans)
(‘we’, ‘humans’)
‘we are humans’
The expression a{5} will match _____________ characters with the previous regular expression.
5 or less
exactly 5
5 or more
exactly 4
Enter Your Name
Enter Your Enrolment No
Enter Your Branch(CSE, CSE-DS, CSE-AIML, CSIT, CY, IT)
Enter Your Acropolis Email ID
Enter Your Batch(2026 or 2027)
