FOCES · CECVolunteer→

Tripy 2.0

CC1vsCC2

HOW IT WORKS

  1. Read the question here.
  2. Write and run code on your laptop.
  3. Raise your hand. A volunteer verifies and scores CC1 / CC2.

Checking which days are open…

E1 — Hello print

1 pt · easy

Print Hello, Tripy on the screen.

E2 — Two lines

1 pt · easy

Print your name on line 1 and your lab (CC1 or CC2) on line 2.

E3 — Name variable

1 pt · easy

Store your name in a variable and print it.

E4 — Echo input

1 pt · easy

Take a word as input and print it back.

E5 — Add two numbers

1 pt · easy

Take two numbers as input and print their sum.

E6 — Subtract

1 pt · easy

Take two numbers and print the first minus the second.

E7 — Multiply

1 pt · easy

Take two numbers and print their product.

E8 — Divide

1 pt · easy

Take two numbers and print a / b.

E9 — Floor division

1 pt · easy

Take two numbers and print how many full times b fits in a.

E10 — Remainder

1 pt · easy

Take two numbers and print the remainder of a divided by b.

E11 — Power

1 pt · easy

Take a and b and print a raised to b.

E12 — Precedence

1 pt · easy

Take a, b, c. Print a + b * c.

E13 — Brackets win

1 pt · easy

Take a, b, c. Print (a + b) * c.

E14 — Input type

1 pt · easy

Take any input and print its type.

E15 — To int

1 pt · easy

Take a decimal number as text and print it as an integer.

E16 — To float

1 pt · easy

Take a whole number and print it as a float.

E17 — Even or odd

1 pt · easy

Take a number and print even or odd.

E18 — Positive check

1 pt · easy

Print positive if the input is above 0, else print negative.

E19 — Pass mark

1 pt · easy

Print pass if marks are 40 or more, else fail.

E20 — Bigger of two

1 pt · easy

Take two numbers and print the bigger one.

M1 — Sign check

2 pts · medium

Print positive, negative, or zero for the input.

M2 — Add or sub menu

2 pts · medium

Take a choice (add or sub) plus two numbers, print the result.

M3 — Average of 3

2 pts · medium

Take 3 marks and print their average.

M4 — Celsius to F

2 pts · medium

Take Celsius and print Fahrenheit. F = C * 9/5 + 32.

M5 — Largest of 3

2 pts · medium

Take 3 numbers and print the largest.

M6 — Grade bands

2 pts · medium

Marks 90+ print A, 75+ print B, 60+ print C, 40+ print D, else F.

M7 — Divisible by 5 and 11

2 pts · medium

Print yes if the number divides by both 5 and 11, else no.

M8 — Vowel check

2 pts · medium

Take one letter and print vowel or consonant.

M9 — Teen check

2 pts · medium

Print teen if age is 13 to 19 inclusive, else not teen.

M10 — FizzBuzz lite

2 pts · medium

Print fizz if divisible by 3, buzz if by 5, fizzbuzz if by both, else the number.

M11 — Swap two

2 pts · medium

Take two numbers, swap them, print both on one line.

M12 — Minutes to sec

2 pts · medium

Take minutes and seconds, print total seconds.

M13 — Discount bill

2 pts · medium

Take price and discount percent, print the final price.

M14 — Day name

2 pts · medium

Take 1-7 and print Monday to Sunday. Anything else prints invalid.

M15 — Absolute value

2 pts · medium

Print the absolute value without using abs().

M16 — Triangle valid

2 pts · medium

Take 3 sides. Print valid if they form a triangle, else invalid.

M17 — Simple interest

2 pts · medium

Take principal, rate, years. Print interest = P*R*T/100.

M18 — Even and in range

2 pts · medium

Print yes if the number is even and between 10 and 99, else no.

M19 — Smallest of 3

2 pts · medium

Take 3 numbers and print the smallest.

M20 — Char or digit

2 pts · medium

Take one character. Print digit if 0-9, letter if a-z or A-Z, else other.

H1 — Full menu calc

4 pts · hard

Menu: add, sub, mul, div. Take choice + two numbers, print result. Div by zero prints cannot divide by zero.

H2 — Leap year

4 pts · hard

Print leap if the year is a leap year, else common.

H3 — Triangle type

4 pts · hard

Take 3 sides. Print invalid, equilateral, isosceles, or scalene.

H4 — Roots nature

4 pts · hard

Take a, b, c of ax^2+bx+c. Print real-equal, real-distinct, or imaginary from D = b*b-4ac.

H5 — Power bill slabs

4 pts · hard

First 100 units cost 3 each, next 100 cost 5 each, rest cost 8 each. Print the bill.

H6 — RPS winner

4 pts · hard

Two players enter rock, paper, or scissors. Print player1, player2, or draw.

H7 — ATM withdraw

4 pts · hard

Take balance and amount. Print new balance if amount is a multiple of 100 and within balance, else print denied.

H8 — Login check

4 pts · hard

Username must be admin and password tripy123. Print welcome or denied.

H9 — Seconds to h:m:s

4 pts · hard

Take total seconds, print hours minutes seconds.

H10 — Middle of 3

4 pts · hard

Take 3 different numbers and print the middle one.

H11 — 3-digit palindrome

4 pts · hard

Take a 3-digit number. Print yes if it reads the same backwards.

H12 — Armstrong 3-digit

4 pts · hard

Print armstrong if the number equals the sum of the cubes of its digits.

H13 — Gross salary

4 pts · hard

Basic <= 10000: HRA 20%, DA 80%. Else HRA 25%, DA 90%. Print gross = basic + HRA + DA.

H14 — Exam pass

4 pts · hard

Take 3 subject marks. Print pass if each is 40+ and average is 50+, else fail.

H15 — Sort 3 numbers

4 pts · hard

Take 3 numbers and print them in ascending order without sort().

H16 — Speed fine

4 pts · hard

Speed <= 60 prints ok, 61-80 prints fine 500, 81-100 prints fine 1000, above prints seized.

H17 — Voter + senior

4 pts · hard

Age < 18 prints minor, 18-59 prints voter, 60+ prints senior voter.

H18 — Digit sum vs product

4 pts · hard

Take a 2-digit number. Print sum-first if digit sum > digit product, else product-first.

H19 — Extended calc

4 pts · hard

Menu add, sub, mul, div, mod, pow. Guard div/mod by zero. Unknown op prints unknown.

H20 — Largest of 4

4 pts · hard

Take 4 numbers and print the largest without max().