Skip to content

Latest commit

 

History

History
68 lines (39 loc) · 1.83 KB

03-basic-knowledge-exercise.md

File metadata and controls

68 lines (39 loc) · 1.83 KB

Question 1

Create a variable "marks" and assign any number. If the marks are greater than 60, then print "Pass," else print "Fail."

Question 2

Take two numbers and check if both numbers are odd or not. If they are both odd, then print "Odd," otherwise print "Even."

Question 3

Take four variables, "a," "b," "c," and "d," and assign their values in the following way: a = b, b = c, c = d, d = a. Check the output.

Question 4

Print the 2's table using the ** operator. Use any logic, but it should print the 2's table.

Question 5

Check the output of the following expressions and validate your answers:

2+5*10-20**2
20/5*10+10

Question 6

Take a number and check if the number is odd or not. If the number is odd, then print "Yes," else print "No."

Question 7

Take a number and check if the number is divisible by 10 and 5. If it is divisible, then print "Yes," else print "No."

Question 8

Take a number and check if multiplying the number by 20 makes it 100 or not. If it does, then print "Yes," else print "No."

Question 9

Calculate your 10th percentage and print "Pass" or "Fail." If the marks are more than 70, then print "Pass," else print "Fail."

Question 10

Take your age and check if your age is greater than 21. If it is, print "Adult," else print "Minor."

Question 11

Convert a if-else solution to ternary operator solution. So, instead of using if-else, use the ternary operator.

Question 12

Implement mark-sheet logic

Take a field "percentage"
If percentage is >= 80 then print "Distinction"
If percentage is >= 60 and < 80 then print "First division"
If percentage >= 33 and < 60 then print "Second division"
if percentage < 33 then print "Fail"

Question 13

Write a logic to find the maximum of 2 numbers

Question 14

Write a logic to find maximum of 3 numbers