Quiz Space

Python OPPE 2: September 2024, Set 1 (September 2024 term)

Question 1

+10 marksProgramming

Write a function is_even_two_digit_number(num) that returns True if num is a two-digit number (the sign is ignored, so -36 has two digits) and it is even. Otherwise it returns False.

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_even_two_digit_number(24) -> True
is_even_two_digit_number(-36) -> True

Your task

Implement this function:

def is_even_two_digit_number(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

24

Output

True

Question 2

+10 marksProgramming

Write a function is_dot_com_or_dot_in(domain) that returns True if the string domain ends with .com or .in (the dot is part of the ending), 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_dot_com_or_dot_in("example.com") -> True
is_dot_com_or_dot_in("website.in") -> True

Your task

Implement this function:

def is_dot_com_or_dot_in(domain: 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: domain.

Example

Input

"example.com"

Output

True

Question 3

+10 marksProgramming

Both lists l1 and l2 have an even length. Split each list into its first half and its second half. Write a function is_present_in_opposite_halves(elem, l1, l2) that returns True if elem is in the first half of one list and in the second half of the other list, 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_present_in_opposite_halves(3, [1, 2, 3, 4], [5, 6, 3, 8]) -> False
is_present_in_opposite_halves(6, [5, 6, 7, 8], [1, 2, 6, 4]) -> True

Your task

Implement this function:

def is_present_in_opposite_halves(elem, l1: list, l2: list) -> 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: elem, l1, l2.

Example

Input

3
[1, 2, 3, 4]
[5, 6, 3, 8]

Output

False

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 Sept 2024 Set 1 paper

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

Other sets that day

More Python