Quiz Space

Programming in Python OPPE 2: May 2025, Set 2 (May 2025 term)

Question 1

+10 marksProgramming

Write a function is_multiple_of_5_not_3(num) that returns True if num is divisible by 5 but is not divisible by 3, and False otherwise.

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

is_multiple_of_5_not_3(10) -> True
is_multiple_of_5_not_3(15) -> False

Your task

Implement this function:

def is_multiple_of_5_not_3(num: int) -> bool:

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

10

Output

True

Question 2

+10 marksProgramming

Write a function starts_with_greeting(s) that returns True if the string s starts with "Hello " or with "Hi ", including the space after the word. Otherwise it returns False. The check is case sensitive.

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

starts_with_greeting("Hello World") -> True
starts_with_greeting("Hi There") -> True

Your task

Implement this function:

def starts_with_greeting(s: str) -> bool:

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.

Example

Input

"Hello World"

Output

True

Question 3

+10 marksProgramming

Write a function combine_edges(s) that returns a string made of the first two characters of s followed by its last two characters. If s has fewer than 4 characters, return the empty string "".

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

combine_edges("Programming") -> 'Prng'
combine_edges("abc") -> ''

Your task

Implement this function:

def combine_edges(s: str) -> 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: s.

Example

Input

"Programming"

Output

'Prng'

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 2 May 2025 Set 2 paper

The IIT Madras BS Programming in Python (Python) OPPE 2 paper sat on May 2025, in the May 2025 term (T2 2025), set 2: 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 2 May 2025 Set 2 at a glance
TermMay 2025 term (T2 2025)
SubjectProgramming in Python
Course codeBSCS1002
Questions7
Marks100
Duration180 min
Programming7
Official paperOPPE 2, May 2025 Set 2
Negative markingNo negative marking.
Updated

Other sets that day

Same OPPE 2, other subjects

More Python