Home Programming Kids Programming Hardware & Software Hardware & Networking APP security Software Education Kids Study MCQS Download OTHERS Login

Python MCQ Question with Answers for Freshers

Categories: MCQS

Python MCQ Question with Answers for Freshers

 

1. Which of the following is not a data type in Python?

a) Integer

b) Float

c) String

d) Character

Answer: d) Character

 

2. What is the output of the following code?

x = 2

y = 3

print(x*y)

 

a) 6

b) 5

c) 8

d) 2*3

Answer: a) 6

 

3. Which of the following is a loop statement in Python?

 

a) if

b) for

c) while

d) def

Answer: b) for and c) while

 

4. What is the output of the following code?

x = [1, 2, 3, 4]

print(x[2])

 

a) 1

b) 2

c) 3

d) 4

Answer: c) 3

 

5. Which of the following is not a keyword in Python?

 

a) if

b) for

c) while

d) main

Answer: d) main

 

6. What is the output of the following code?

x = "Hello World"

print(x[2:7])

 

a) Hello

b) World

c) lo Wo

d) llo W

Answer: c) lo Wo

 

7. Which of the following is used to check the length of a string in Python?

 

a) len()

b) str()

c) int()

d) float()

Answer: a) len()

 

8. What is the output of the following code?

x = 10

y = 5

if x > y:

print("x is greater than y")

 

a) x is greater than y

b) y is greater than x

c) x and y are equal

d) There is a syntax error in the code

Answer: a) x is greater than y

 

9. Which of the following is not a comparison operator in Python?

 

a) ==

b) !=

c) >=

d) ++

Answer: d) ++

 

10. What is the output of the following code?

x = [1, 2, 3]

y = x

y.append(4)

print(x)

 

a) [1, 2, 3]

b) [1, 2, 3, 4]

c) [2, 3, 4]

d) [1, 4, 2, 3]

Answer: b) [1, 2, 3, 4]

Python MCQ Question with Answers for Freshers