Exam in
46 questions
Which of the following statements is correct in this python code?
What will the following python code print?
In the following Python statements: if2<1:
print("Two is less than one!")
In the following Python statements:
if 1>2:
print("One is less than Two!")
x = { "name": "Ahmed", "id": "1", "mobile": 123456789, "mobile": 987654321 }
print(x)
The above print will return:
def f (**person):
f (name= "Ahmed", age=10)
print("Person's name is " + person["name"])
The above statement will return:
def f(**person):
f(name="Ahmed", age=10)
y = lambda x: x/20
print(y(100))
y = lambda x: x / 20
In Python, the value of [] is False.
In the following statement: myNumbers = {1, 2, 3}
x = myNumbers.pop()
The removed item will be 3.
In Python, the value of bool([]) is False?
In Python, it is possible to use the set() constructor to create a set?
In python, a set is a collection which is unordered and unindexed.
In the following statement: myNumbers = [1,2,3]
my-var is an incorrect variable name in Python.
Strip() function is used to remove whitespaces from the beginning and end of a string in Python.
y= ("apple",) is a tuple.
In Python. A set is a collection which is both unordered and indexed.
x=("apple", "banana", "cherry") is a definition of a list.
In the following statement: myNumbers = [1, 2, 3]
The removed item will be 1
In Python, format function is used to format the datatypes of the output.
In Python, A set is a collection which is both unordered and indexed.
In Python, to append elements from another list to the current list, use the update() method.
In Python, to add items from another set into the current set, use the extend() method.
The removed item will be 1.
x = ("apple", "banana", "cherry") is a definition of a list.
The output of the following statements is Hello, My
b= "Hello, My Friend"
Print (b [:8])
The output of the following Python statements is ['a', 'b', 'C']
X=['C','b','a']
X.sort()
Print(X)
The output of the following Python statements is ['a', 'b', 'c']
X=['C','b','A']
X.sort(key=str.lower)
In Python, ______ defines a block of statements.
What will be the output of the following python code?
newtuple = (1, 2, 3, 4)
(*k,) = newtuple
print(k)
What will be the output of the following Python code?
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
y = car.keys()
car["color"] = "red"
print(len(y))
newtuple = (1,2,3,4)
Print(k)
(x, *k, y) = newtuple
b = "Hello, World!"
print(b[-5:-2])
thistuple = (1, 2, 3, 3, 4, 5)
x = thistuple.index(3)
fruits = {"apple", "banana", "cherry"}
fruits.add("apple")
x = len(fruits)
car= {
y= car["color"] = "red"
To add items from another set to the current set we use ______ method, while to append items from another list to the current list we use ______.
To make a copy of a dictionary, we can use
The output of the following statement in python is:
x = "My Lovely Bird!"
print(x[:7])
print(x[-7:])
In the following Python Statements:
Y={1,1,2,3,3,5}
print(Y)
The output will be:
Y=set(("a","b","c"))
Print(y)
newtuple=(1,2,3)
(x, *k, y, z, m) = newtuple