# IT's All About Python Programming Language Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Yetunde Folajimi
Y
Yetunde Folajimi
Community Contributor
Quizzes Created: 3 | Total Attempts: 1,496
Questions: 20 | Attempts: 277  Settings  These questions are based on introduction about python programming language. Let's take this quiz and learn about it!

• 1.

### What will the following Python statements output?print("Answer = ", 2*5)

Explanation
The given Python statements will output "Answer = 10". The print() function is used to display the output on the console. In this case, it will print the string "Answer = " followed by the result of the expression 2*5, which is 10.

Rate this question:

• 2.

### What will the following Python statements output?print("Age:", "20+5")

Explanation
The given Python statements will output "Age: 20+5". This is because the print() function is used to display the specified message on the console. In this case, the message is "Age:" followed by the string "20+5". Since the string is enclosed in quotes, it is treated as a literal string and not as a mathematical expression. Therefore, the output will be the exact string "Age:20+5".

Rate this question:

• 3.

### What will the following Python statements output?print(float(34+5))

Explanation
The given Python statements will output 39.0. This is because the expression inside the float() function, 34+5, evaluates to 39. The float() function is used to convert the result to a floating-point number, and since the result is already a whole number, it remains the same as 39.0.

Rate this question:

• 4.

### What will the following Python statements output?print(int(6.9))

Explanation
The given Python statement `print(int(6.9))` will output the integer value 6. The `int()` function is used to convert a value to an integer. In this case, the float value 6.9 is being converted to an integer, which results in the value 6.

Rate this question:

• 5.

### print("Answer = ", 2+5) _____________________

Explanation
The given code will print "Answer = 7" because it is concatenating the string "Answer = " with the result of the addition operation 2+5, which is 7.

Rate this question:

• 6.

### print("Age:", "20") _________________________

Explanation
The given code snippet prints the string "Age:" followed by the string "20". The comma between the two strings acts as a separator, allowing both strings to be printed on the same line. Therefore, the output of the code is "Age: 20".

Rate this question:

• 7.

### Print(int(30.5+4.2)) _________________________

Explanation
The given expression calculates the sum of 30.5 and 4.2, which results in 34. Since the print function is used to display the value as an integer, the decimal part of the sum is truncated, and the output is 34.

Rate this question:

• 8.

### Print(float(6)) _________________________

Explanation
The code "print(float(6))" converts the integer value 6 to a floating-point number and then prints it. In Python, the float() function is used to convert a value to a floating-point number. Since 6 can be represented as a floating-point number without any decimal places, the result is 6.0.

Rate this question:

• 9.

### What do you think the following Python statements outputprint("Age:", 20) _________________________

Explanation
The given Python statements use the print() function to output the string "Age:" followed by the integer 20. The comma between the two arguments in the print() function separates them and results in both being printed on the same line. Therefore, the output will be "Age: 20, Age:20".

Rate this question:

• 10.

### What do you think the following Python statements outputprint(float(35-18)) _________________________

Explanation
The given Python statement calculates the result of the expression 35-18, which is 17. The float() function is then used to convert this result into a floating-point number. Therefore, the output of the print statement will be 17.0.

Rate this question:

• 11.

### What do you think the following Python statements outputprint(int(8/3)) _________________________

Explanation
The given Python statement "print(int(8/3))" outputs the value 2. This is because the division operation "8/3" results in a floating-point number 2.6666666666666665, but the "int()" function converts it to an integer by truncating the decimal part, resulting in the value 2. The "print()" function then displays this value as the output.

Rate this question:

• 12.

• 13.

### In the following program segment, what is the final output and how many times will the program loop be performed?count = 1while count < 9:print(count)count = count +2

• A.

Last Output: 9, loop: 9

• B.

Last Output: 8, loop: 8

• C.

Last Output: 9, loop: 8

• D.

The program will not execute

B. Last Output: 8, loop: 8
Explanation
The final output of the program will be 8 and the program loop will be performed 8 times. This is because the initial value of count is 1 and it is incremented by 2 in each iteration of the loop. So, the loop will continue until count is less than 9, which means it will run for the values 1, 3, 5, 7. Since the loop runs 4 times, the final value of count will be 7+2 = 8. Therefore, the last output will be 8 and the loop will be performed 8 times.

Rate this question:

• 14.

### What will be the output of the following program segment?aNum = 123aString = 2*str(aNum)print (aString)

• A.

246

• B.

246246

• C.

123123

• D.

'123123'

C. 123123
Explanation
The program segment first assigns the value 123 to the variable aNum. Then, it converts aNum to a string using the str() function and multiplies it by 2. The result is stored in the variable aString. Finally, the value of aString is printed, which is '123123'.

Rate this question:

• 15.

### Ade has written the following pseudocode to multiply all positive integers less than 3. Is there any error in the pseudocode?x ← 0i ← 1While (i<3)x ← x * ii ← i+1

• A.

The initial value of x should be 1

• B.

i

• C.

There should be read statement for x

• D.

No error

A. The initial value of x should be 1
Explanation
The initial value of x should be 1 because if it is set to 0, then any value multiplied by 0 will always be 0. Since the pseudocode is meant to multiply all positive integers less than 3, setting x to 0 would result in an incorrect answer.

Rate this question:

• 16.

### What will be the final value of the variable count in the following pseudocode?count ← 1sum ← 0while(count<5)input numberSum = sum + numbercount = count +1

• A.

4

• B.

5

• C.

79

• D.

9

B. 5
Explanation
The pseudocode initializes the variable count to 1 and the variable sum to 0. It then enters a while loop that continues as long as count is less than 5. Inside the loop, it takes an input number and adds it to the sum. It also increments the count by 1. Therefore, the loop will execute 4 times and the count will be incremented to 5. So, the final value of the variable count will be 5.

Rate this question:

• 17.

### Which of the following code is correct?

• A.

Print("Programming is fun") print("Python is fun")

• B.

Print('Programming is fun') print('Python is fun')

• C.

None

• D.

Both

B. Print('Programming is fun') print('Python is fun')
Explanation
The correct answer is "print('Programming is fun')\n\nprint('Python is fun')". This is the correct code because it prints the statements "Programming is fun" and "Python is fun" on separate lines. The code is formatted correctly with the print statements indented properly.

Rate this question:

• 18.

### Print (7-6/2*3+ 10) will give output_____________ on Java

• A.

8.0

• B.

8.90

• C.

8

• D.

11.5

C. 8
Explanation
The expression (7-6/2*3+ 10) can be simplified using the order of operations in Java. First, the division operation 6/2 is performed, resulting in 3. Then, the multiplication operation 3*3 is performed, resulting in 9. Next, the subtraction operation 7-9 is performed, resulting in -2. Finally, the addition operation -2+10 is performed, resulting in 8. Therefore, the output of the expression is 8.

Rate this question:

• 19.

### If A = 1.0, B = 1.0 and C = 2.0, find the value of X inX = (4*B - B^2)/(2-A)

• A.

1.0

• B.

1.5

• C.

3.0

• D.

5.0

C. 3.0
Explanation
The given equation is X = (4*B - B^2)/(2-A). Plugging in the given values, we get X = (4*1.0 - 1.0^2)/(2-1.0) = (4-1)/(2-1) = 3/1 = 3.0. Therefore, the value of X is 3.0.

Rate this question:

• 20.

### If A = 1.0, B = 1.0 and C = 2.0, find the value of X inX = (2*A+B)+C/2*C

• A.

4.0

• B.

5.0

• C.

6.0

• D.

8.0

B. 5.0
Explanation
The value of X can be found by substituting the given values of A, B, and C into the equation. X = (2*1.0 + 1.0) + 2.0/2*2.0 = (2 + 1) + 2/4 = 3 + 0.5 = 3.5. Therefore, the given answer of 5.0 is incorrect.

Rate this question:

Related Topics Back to top