Question 1
Only snippet-1 is correct
Only snippet-2 is correct
Both snippets 1 and 2 are correct
Both snippets 1 and 2 are incorrect
The IIT Madras BS Programming in Python (Python) End Term paper sat on 24 Dec 2023, in the September 2023 term, set ADD3: 19 questions for 50 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Only snippet-1 is correct
Only snippet-2 is correct
Both snippets 1 and 2 are correct
Both snippets 1 and 2 are incorrect
Correct answer
Both snippets 1 and 2 are incorrect
Correct answer
Correct answer
Only snippet-1 is correct
Only snippet-2 is correct
Both snippets 1 and 2 are correct
Both snippets 1 and 2 are incorrect
Correct answer
Only snippet-1 is correct
Sum of digits in n
Number of digits in n
Product of digits in n
Factorial of n
Correct answer
Number of digits in n
Correct answers
Correct answers
Correct answers
This code outputs the sum of all perfect squares less than n
This code outputs the sum of all positive integers whose square is less than n
The output of this code is 28 when the input is 50.
The output of this code is 140 when the input is 50.
Correct answers
This code outputs the sum of all positive integers whose square is less than n
The output of this code is 28 when the input is 50.
Correct answer: 3
Correct answer: 5
Correct answer: 131
Correct answer: 4
Based on the above data, answer the given subquestions.
What is the output of the following snippet?
Correct answer
Based on the above data, answer the given subquestions.
Continuing with the previous subquestion, what is the output of the following snippet?
Enter an integer.
Correct answer: 2
Based on the above data, answer the given subquestions.
What is the given code snippet printing?
It prints the number of button presses after which you reach the floor -1 for the first time.
It prints the number of times you cross the floor -1 .
It prints the final floor level after all the button presses.
Correct answer
It prints the number of button presses after which you reach the floor -1 for the first time.
Based on the above data, answer the given subquestions.
What is the output of this snippet of code?
Correct answer: 7
Based on the above data, answer the given subquestions.
What is the first line of output?
Correct answer
Based on the above data, answer the given subquestions.
What is the second line of output?
Correct answer: 105