🧩

Logic Building - Phase 6: Mixed Logical Challenges

Apply all concepts together to solve complex, real-world logical problems

50 questions•5 pages•~75 min
Progress: 0 / 500%
Page 1 of 5 • Questions 1-10 of 50
Q1medium

What does this code do? arr = [1, 2, 3, 4, 5] result = [] for num in arr: if num % 2 == 0: result.append(num * 2) else: result.append(num) print(result)

Q2medium

What is the output?

s = "Hello123"
digits = 0
letters = 0
for ch in s:
    if ch.isdigit():
        digits += 1
    elif ch.isalpha():
        letters += 1
print(f"Digits: {digits}, Letters: {letters}")
Q3medium

What will this code print? def check(num): return num > 0 and num % 2 == 0 and 10 <= num <= 99 print(check(24))

Q4hard

What does this code calculate? arr = [5, 2, 8, 1, 9, 3] count = 0 for num in arr: if num > sum(arr) / len(arr): count += 1 print(count)

Q5medium

What is the result?

s = "programming"
vowels = "aeiou"
count = 0
for ch in s:
    if ch.lower() in vowels:
        count += 1
print(count)
Q6hard

What will be printed? arr = [1, 2, 3, 4, 5] s = "Hello" result = [x for x in arr if x % 2 == 0] + [len(s)] print(result)

Q7hard

What is the output?

num = 123
s = str(num)
result = sum([int(ch) for ch in s if int(ch) % 2 == 0])
print(result)
Q8hard

What will be printed? arr = [10, 20, 30, 40] s = "Python" result = [arr[i] for i in range(len(arr)) if i < len(s)] print(result)

Q9medium

What does this code do? def process(num, s): if num > 0 and len(s) > 0: return num * len(s) return 0 print(process(5, "Hi"))

Q10hard

What is the result?

arr = [1, 2, 3, 4, 5]
s = "abc"
result = [arr[i] if i < len(arr) else s[i-len(arr)] for i in range(8)]
print(result)
...