Quiz Space

Python OPPE 1: September 2025, Set 4 (September 2025 term)

Question 1

+10 marksProgramming

Write a function that checks whether a given number is divisible by both of its last two digits.

Return False if any of the last two digits is zero.

NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.

Input: A positive integer num with at least two digits.
Output: True if the number is divisible by both of its last two digits, otherwise False.

Examples

1236 -> True, 1236 is divisible by both 3 and 6.
345 -> False, 345 is divisible by 5 but not divisible by 4.
748 -> False, 748 is divisible by 4 but not divisble by 8.
740 -> False, the last digit is 0.

Your task

Implement this function:

def is_divisible_by_last_two_digits(num: int):

Write the function only — the arguments are read for you and the return value is printed automatically.

Arguments arrive as one Python literal per line, in this order: num.

Example

Input

1236

Output

True

Question 2

+10 marksProgramming

Write a function bold_nth_character(text: str, n: int) -> str that takes a string text and an integer n as input.

The function should return a new string where the nth character (using 1-based indexing) is wrapped with an HTML <b> tag — i.e., <b>char</b>.

If:

n is less than 1, or n is greater than the length of the string,

then return the original string unchanged.

NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.

Example

>>> bold_nth_character("mango", 2)
"m<b>a</b>ngo"

Explanation

The 2nd character is 'a'. Wrapping it gives "m<b>a</b>ngo".

Your task

Implement this function:

def bold_nth_character(text: str, n: int) -> str:

Write the function only — the arguments are read for you and the return value is printed automatically.

Arguments arrive as one Python literal per line, in this order: text, n.

Example

Input

"mango"
2

Output

'm<b>a</b>ngo'

Question 3

+10 marksProgramming

Write a function separate_outer_chars that removes n characters from both the beginning and end of a given string s and creates a tuple with two strings ('outer_chars', 'inner_chars') with the outer chars joined together as the first element and the inner chars as the second element.

Assume the length of the string s will be greater than or equal to 2*n.

NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.

Example

>>> s = "programming"
>>> n = 3
>>> separate_outer_chars(s,n)
("proing", "gramm")

Three characters from start and end of the word programming is removed.

Your task

Implement this function:

def separate_outer_chars(s, n):

Write the function only — the arguments are read for you and the return value is printed automatically.

Arguments arrive as one Python literal per line, in this order: s, n.

Example

Input

"programming"
3

Output

('proing', 'gramm')

4 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Python OPPE 1 Sept 2025 Set 4 paper

The IIT Madras BS Programming in Python (Python) OPPE 1 paper sat on Sept 2025, in the September 2025 term (T3 2025), set 4: 7 questions for 100 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeaturePython OPPE 1 Sept 2025 Set 4 at a glance
TermSeptember 2025 term (T3 2025)
SubjectProgramming in Python
Course codeBSCS1002
Questions7
Marks100
Duration180 min
Programming7
Official paperOPPE 1, Sep 2025 Set 4
Negative markingNo negative marking.
Updated

Other sets that day

Same OPPE 1, other subjects

More Python