0% found this document useful (0 votes)
35 views6 pages

Section 1: Multiple Choice Questions: What Is The Output of This Code?

The document consists of multiple sections containing various types of questions related to programming concepts, including multiple choice questions, output-based questions, and coding challenges. Topics covered include basic arithmetic operations, string manipulation, list operations, and user input handling. The document aims to test knowledge and skills in Python programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views6 pages

Section 1: Multiple Choice Questions: What Is The Output of This Code?

The document consists of multiple sections containing various types of questions related to programming concepts, including multiple choice questions, output-based questions, and coding challenges. Topics covered include basic arithmetic operations, string manipulation, list operations, and user input handling. The document aims to test knowledge and skills in Python programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Section 1: Multiple Choice Questions

1. What is the output of this code?

a = 12
b = 5
print(a // b)

o a) 2.4

o b) 2

o c) 3

o d) 3.0

2. Which operator gives the remainder after division?

o a) //

o b) %

o c) /

o d) **

3. What will be the output?

print("Python" + "3")

o a) Python 3

o b) Python3

o c) Python+3

o d) Error

4. Which operator is used to raise a number to a power?

o a) ^

o b) **

o c) //
o d) *

5. What is the result of:

print(2 * 3 ** 2)

o a) 36

o b) 18

o c) 12

o d) 16

Section 2: Output-Based Questions

Predict the output for each:

print("Hi" * 3)

1. Output:

a = 15
b = 4
print(a % b)

2. Output:

print("8" + "8")

3. Output:

x = 2
y = 5
print(x ** y)

4. Output:

print("Py" + "thon" * 2)

5. Output:
Section 3: Coding Questions

1. Write a program to read two numbers from the user and print their sum, difference, product,
and quotient.

2. Write a program that prints the result of 7 divided by 3, both as regular division and floor
division.

3. Write a program that takes a word from the user and prints it three times, separated by a
space.

4. Write a program to concatenate the strings "Grade", "8", and "Python" with a dash (-)
between each word.

5. Write a program to check if the result of 5 multiplied by 4 is greater than 18 and print the
result as True or False.

Section 4: Advanced (Challenging) Questions

1. What will be the output?

print("2" * 3 + "3" * 2)

Output:

2. Fill in the blank to print HelloWorld! using string concatenation:

print("Hello" _____ "World" _____ )

3. Without using multiplication, write a program that prints the string "abcabcabc" using
concatenation.

4. What is the output?

print(10 / 3)
print(10 // 3)

Output:

5. What will be the output?


print("5" + str(5))

Section 5: Multiple Choice Questions

1. What is the output of the following code?

fruits = ['apple', 'banana', 'cherry']


print(fruits[^1])

o a) apple

o b) banana

o c) cherry

o d) 1

2. Which code creates a list of three numbers?

o a) numbers = 1, 2, 3

o b) numbers = [1,2,3]

o c) numbers = {1, 2, 3}

o d) numbers = (1, 2, 3)

3. What will be the output?

colors = ['red', 'green', 'blue']


print(colors[-1])

o a) red

o b) green

o c) blue

o d) -1

4. Which of the following is the correct way to access the first element of a list named mylist?

o a) mylist[1]

o b) mylist(0)
o c) mylist

o d) mylist{0}

5. What is the output of:

nums = [10, 20, 30]


print(nums[0] + nums[2])

o a) 10

o b) 30

o c) 40

o d) 50

Section 6: Output-Based Questions

Predict the output for each:

a = [5, 6, 7]
print(a[2])

1. Output:

names = ['Tom', 'Jerry', 'Spike']


print(names[0] + " & " + names[1])

2. Output:

x = ['a', 'b', 'c', 'd']


print(x[-2])

3. Output:

numbers = [3, 6, 9]
print(numbers[1] * numbers[0])

4. Output:
word = ['Py', 'thon']
print(word[0] + word[1])

Section 7: Coding Questions

1. Create a list called cities with the values "Delhi", "Mumbai", and "Chennai". Print the second
city.

2. Write a program to create a list of three numbers. Print the sum of the first and last number
using their indexes.

3. Create a list with the numbers 2, 4, 6, 8. Print the product of the second and third elements.

You might also like