Week 03-01
Week 03-01
25 53 false false
27 77 true true
Question 2
Objective
Correct
Marked out of
5.00 In this challenge, we're getting started with conditional statements.
Flag question
Task
Complete the stub code provided in your editor to print whether or not n is weird.
Input Format
REC-CIS
Constraints
Output Format
Sample Input 0
Sample Output 0
Weird
Sample Input 1
24
Sample Output 1
Not Weird
REC-CIS
Explanation
Sample Case 0: n = 3
Sample Case 1: n = 24
3 Weird Weird
Question 3 Three numbers form a Pythagorean triple if the sum of squares of two numbers is
Correct equal to the square of the third. For example, 3, 5 and 4 form a Pythagorean triple,
Marked out of since 3*3 + 4*4 = 25 = 5*5 You are given three integers, a, b, and c. They need not be
7.00 given in increasing order. If they form a Pythagorean triple, then print "yes", otherwise,
Flag question print "no". Please note that the output message is in small letters. Sample Input 1 3 5 4
Sample Output 1 yes Sample Input 2 5 8 2 Sample Output 2 no
3 yes yes
5
4
5 no no
8
2
Finish review
REC-CIS
Correct
Write a program that determines the name of a shape from its number of sides. Read
Marked out of
the number of sides from the user and then report the appropriate name as part of a
3.00
meaningful message. Your program should support shapes with anywhere from 3 up to
Flag question
(and including) 10 sides. If a number of sides outside of this range is entered then your
program should display an appropriate error message.
Sample Input 1
Sample Output 1
Triangle
Sample Input 2
7
REC-CIS
Sample Output 2
Heptagon
Sample Input 3
11
Sample Output 3
3 Triangle Triangle
7 Heptagon Heptagon
Question 2
The Chinese zodiac assigns animals to years in a 12-year cycle. One 12-year cycle is
Correct
shown in the table below. The pattern repeats from there, with 2012 being another
Marked out of
year of the Dragon, and 1999 being another year of the Hare.
5.00
Flag question
Year Animal
2000 Dragon
2001 Snake
REC-CIS
2002 Horse
2003 Sheep
2004 Monkey
2005 Rooster
2006 Dog
2007 Pig
2008 Rat
2009 Ox
2010 Tiger
2011 Hare
Write a program that reads a year from the user and displays the animal associated
with that year. Your program should work correctly for any year greater than or equal
to zero, not just the ones listed in the table.
Sample Input 1
2004
Sample Output 1
Monkey
Sample Input 2
2010
REC-CIS
Sample Output 2
Tiger
Question 3
Positions on a chess board are identified by a letter and a number. The letter identifies
Correct
the column, while the number identifies the row, as shown below:
Marked out of
7.00
Flag question
Write a program that reads a position from the user. Use an if statement to determine if
the column begins with a black square or a white square. Then use modular arithmetic to
report the color of the square in that row. For example, if the user enters a1 then your
program should report that the square is black. If the user enters d5 then your program
should report that the square is white. Your program may assume that a valid position will
always be entered. It does not need to perform any error checking.
Sample Input 1
REC-CIS
a1
Sample Output 1
Sample Input 2
d5
Sample Output 2
Finish review
REC-CIS
Flag question
There are two calendars - one for normal years with 365 days, and one for leap years
with 366 days. Leap years are divisible by 4. Centuries, like 1900, are not leap years
unless they are divisible by 400. So, 2000 was a leap year.
To find the day of year number for a standard date, scan down the Jan column to find
the day of month, then scan across to the appropriate month column and read the day
of year number. Reverse the process to find the standard date for a given day of year.
Write a program to print the Day of Year of a given date, month and year.
Sample Input 1
18
6
REC-CIS
2020
Sample Output 1
170
18 170 170
6
2020
Question 2
Suppandi is trying to take part in the local village math quiz. In the first round, he is
Correct
asked about shapes and areas. Suppandi, is confused, he was never any good at math.
Marked out of
And also, he is bad at remembering the names of shapes. Instead, you will be helping
5.00
him calculate the area of shapes.
Flag question
REC-CIS
· When he says rectangle he is actually referring to a square.
· And when he is confused, he just says something random. At this point, all you
can do is say 0.
Input Format
· Length of 1 side
Note: In case of triangle, you can consider the sides as height and length of base
Output Format
Sample Input 1
10
20
Sample Output 1
REC-CIS
200
Sample Input 2
S
30
40
Sample Output 2
600
Sample Input 3
10
10
Sample Output 3
100
Sample Input 4
REC-CIS
G
Sample Output 4
Sample Input
10
Sample Output 4
Explanation:
T 200 200
10
20
S 600 600
30
40
B 0 0
2
11
R 300 300
10
30
REC-CIS
S 1000 1000
40
50
Question 3 Superman is planning a journey to his home planet. It is very important for him to
Incorrect know which day he arrives there. They don't follow the 7-day week like us. Instead, they
Marked out of follow a 10-day week with the following days: Day Number Name of Day 1 Sunday 2
7.00 Monday 3 Tuesday 4 Wednesday 5 Thursday 6 Friday 7 Saturday 8 Kryptonday 9
Flag question Coluday 10 Daxamday Here are the rules of the calendar: • The calendar starts with
Sunday always. • It has only 296 days. After the 296th day, it goes back to Sunday. You
begin your journey on a Sunday and will reach after n. You have to tell on which day
you will arrive when you reach there.
Input format: •
Output format: Print the name of the day you are arriving on
Example Input
Example Output
Kryptonday
Example Input
Syntax Error(s)
__tester__.c: In function ‘main’:
__tester__.c:7:18: error: self-comparison always evaluates to false [-
Werror=tautological-compare]
7 | for(int i=0;i<i;i++)
| ^
__tester__.c:10:5: error: expected ‘(’ before ‘}’ token
10 | }
| ^
| (
__tester__.c:6:9: error: unused variable ‘day’ [-Werror=unused-variable]
6 | int day =n%10;
| ^~~
cc1: all warnings being treated as errors
Finish review
REC-CIS