COSC EXAM 2 WITH QUESTIONS
AND ANSWERS LATEST UPDATE
2026
What does this return?
if x == y:
print('x and y are equal')
else:
if x < y:
print('x is less than y')
else:
print('x is greater than y') - ANSWER-x is less than y
What does this return?
if 0 < x:
if x < 10:
print('x is a positive single-digit number.') - ANSWER-x is a
positive single-digit number.
What does this return?
if not x <= 0 and not x >= 10:
, Page | 2
print('x is a positive single-digit number.') - ANSWER-x is a
positive single-digit number.
The time module provides a function, also called time, that
returns returns the number of seconds since the "Unix epoch",
which is January 1, 1970, 00:00:00 UTC (Coordinated
Universal Time).
from time import time
now = time()
now
returns...... - ANSWER-1716394001.8466134
What is the output of the following program?
def recurse(n, s):
if n == 0:
print(s)
else:
recurse(n-1, n+s)
recurse(3, 0) - ANSWER-6