0% found this document useful (0 votes)
4 views

Technical Skill python programming

The document contains a series of Python programming questions along with their respective answers. Each question tests different aspects of Python syntax and functionality, such as string manipulation, list operations, and function definitions. The answers provided indicate the expected output for each code snippet presented.

Uploaded by

gunagvgg2248
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Technical Skill python programming

The document contains a series of Python programming questions along with their respective answers. Each question tests different aspects of Python syntax and functionality, such as string manipulation, list operations, and function definitions. The answers provided indicate the expected output for each code snippet presented.

Uploaded by

gunagvgg2248
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Click to edit Master title style

1
Click to edit Master title style

Technical Skill
Python

2
Click to edit Master title style

1)
minimum = min("programming")
print(minimum)

What is the output of the below


code**
• 1. p
• 2. r
• 3. o
• 4. None of the above
3 3
Click to edit Master title style
Ans:4

2)
maximum = max("python")
print(maximum)
What is the output of the
below code
• 1. p
• 2. y
• 3. t
• 4. None of the above 4 4
Ans:2
Click to edit Master title style
3)
a = 7
a1 = a + 1
a2 = a++

if a1 == a2:
print("Success")
else:
print("Failure")

• What is the output of the below code


• 1. Success
• 2. Failure
• 3. Invalid Syntax
• 4. None of the above
5 5
Ans:3
Click to edit Master title style
4)
a = 7
a1 = 0
a2 = 0
a1 += 1
a2 -= 1

if a1 == a2:
print("Success")
else:
print("Failure")
• What is the output of the below code
• 1. Success
• 2. Failure
• 3. Invalid Syntax
• 4. None of the above 6 6
Click to edit Master title style
Ans:2

5)
l = {'a1':"1", 'a2': "2", 'a3':"3"}
for x, y in l:
print(x[0], end = " ")

• What is the output of the below


code
• 1. a a a
• 2. a1 a2 a3
• 3. 1 2 3
7 7
• 4. None of the above
Ans:1
Click to edit Master title style
6)
l = {'a1':"1", 'a2': "2", 'a3':"3"}
for x in l:
print(x[1], end = " ")

• What is the output of the below code


• 1. a a a
• 2. a1 a2 a3
• 3. 1 2 3
• 4. None of the above
8 8
Ans:3
Click to edit Master title style
8)
l = {'a1':"1", 'a2': "2", 'a3':"3"}
for x in l:
print(x, end = " ")

• What is the output of the below code


• 1. a a a
• 2. a1 a2 a3
• 3. 1 2 3
• 4. None of the above 9 9
Ans:1
Click to edit Master title style
8)
l = ["Every", 1, "Can't", "Be", "The", "Best", 1]
print(l[4][2])

• What is the output of the below code


• 1. e
• 2. The
• 3. T
• 4. Invalid Index
10
10
Ans:1
Click to edit Master title style
9)
value = 6/2*(1+2)
print(value)

• What is the output of the below code


• 1. 9
• 2. 9.0
• 3. 8.9
• 4. Invalid Syntax

11
11
Ans:2
Click to edit Master title style
10)
value = ('1 + 3 * 2’)
print(eval(value))

• What is the output of the below code


• 1. 7
• 2. 7.0
• 3. 6.9
• 4. Invalid Syntax
12
12
Ans:1
Click to edit Master title style
11)
def add(a, b):
c = a + b
return c

result = add(add(add(5, add(5, 6.5)) , 5), 5)


print(result)
• What is the output of the below code
• 1. 22.5
• 2. 23
• 3. 26
• 4. 26.5
13
13
Ans:4
Click to edit Master title style
12)
squares = []
for x in range(5):
squares.append(lambda n=x: n**2)
print(squares[4]())

• What is the output of the below code


• 1. 16
• 2. List index out of range
• 3. 4
• 4. 20
14
14
Ans:1
Click to edit Master title style
13)
print("[{0},{1},{2}]".format(1, 2, 3))

• What is the output of the below code


• 1. (1, 2, 3)
• 2. [1, 2, 3]
• 3. 123
• 4. 1, 2, 3
15
15
Ans:2
Click to edit Master title style
14)
name = 'P Y T H O N’
updated_name = name.split()
print(type(updated_name))

• What would be type of `updated_name` in


this example
• 1. string
• 2. list
• 3. TypeError
• 4. tuple 16
16
Ans:2
Click to edit Master title style
15)
name = 'P Y T H O N’
updated_name = name[::-1]
print(updated_name)

• What is the output of the below code


• 1. P Y T H O N
• 2. N O H T Y P
• 3. P Y T H O
• 4. Invalid Syntax
17
17
Ans:2
Click to edit Master title style
16)
for i in range(15, 20, 1):
print( i, end = ', ')

• What is the output of the below code


• 1. 15, 16, 17, 18, 19,
• 2. 15, 16, 17, 18, 19, 20
• 3. 15, 16, 17, 18, 19
• 4. 15, 16, 17, 18,
18
18
Ans:1
Click to edit Master title style
17)
new_list = [5, 10, 15, 25]
print(new_list[::-2])

• What is the output of the below code


• 1. [25, 10]
• 2. [25, 15, 10, 5]
• 3. [ ]
• 4. ValueError
19
19
Ans:1
Click to edit Master title style
18)
List = [x + y for x in ['Hello ', 'Good’]
for y in ['Dear', 'Bye’]]
print(List)

• What is the output of the below code


• 1. ['Hello Dear', 'Hello Bye', 'GoodDear',
'GoodBye']
• 2. ['Hello Dear', 'Hello Bye', 'GoodDear']
• 3. [ ]
• 4. ['Hello Good', Dear Bye'] 20
20
Ans:1
Click to edit Master title style
19)
List = ["Python", "Programming"]
print("-".join(List))

• What is the output of the below code


• 1. PythonProgramming-
• 2. Python-Programming
• 3. -PythonProgramming
• 4. PythonProgramming

21
21
Ans:2
Click to edit Master title style
20)
a = 5
b = 3

c1 = a/b
c1 = int(c1)
• What is the output of the below code
c2 = a/b
c2 = round(c2) • 1. True
if c1 == c2: • 2. False
print("True")
else: • 3. Unknown
print("False")
• 4. TypeError

22
22
Ans: 2
Click to edit Master title style

23
23

You might also like