Skip to content

Latest commit

 

History

History
57 lines (34 loc) · 2.6 KB

04-basic-knowledge-exercise.md

File metadata and controls

57 lines (34 loc) · 2.6 KB

Question 1

Take two numbers and add a value that is the sum of the two numbers plus another number. Now, find the 3rd number. Write the logic.

Question 2

Ask the following questions:

  • What are your English marks in the 10th grade?
  • What are your Science marks in 10th grade?
  • What are your Math marks in 10th grade?
  • What are your Hindi marks in 10th grade?
  • What are your SST marks in 10th grade?

Now calculate percentage by taking all the 5 subjects numbers.

Question 3

In which century were you born? Find out by asking for your birth year. Use the Math.floor function to remove the decimal portion of the century.

Question 4

  • Add 20 to your name and check the value in the console.
  • Add true to your name and check the output.
  • Add 30 + "learnjavascript" and check the type of the final value.

Question 5

Create a Reverse Game. Ask any question with 2 possible answers. If the user selects the first option, then show the second option in an alert, and vice versa.

For example: "Do you drink coffee or tea?" If the user says "coffee," then show "Tea" in an alert, and if the user says "tea," then show "coffee."

Question 6

Test the following conditions using &&, ||, and not logical operators. Take any number and check if the number is even and also check if the number is a multiple of 4 or not. If both conditions are true, then check if the number is less than 100 or equal to 84 or not.

Question 7

Take the city temperature. If the temperature is less than 10 degrees, then print "very cold." If the city temperature is less than 30 and greater than or equal to 10, then print "cold." If the temperature is between 30 and 40, then print "hot." Else, print "very hot".

Question 8

Using a prompt, ask the user about their age. If the age is greater than 18, then show the user a message, "Do you want to open an account?" If user click on "OK" button then ask the below 4 questions:

  • What is your name ?
  • What is your aaadhar number ?
  • What is your address?
  • What is your mobile number? Print all these details in the console. If user click on "Cancel" then show the message, "Sorry, please visit again."

Question 9

Create a simple calculator. Firstly, ask the user about the operation they want to perform, such as addition, subtraction, etc. After that, ask the user for the first number and then the second number. Finally, show the desired output.

Question 10

Who is the most intelligent in your family? Ask for the 10th-grade percentage of each family member and check who got the highest marks. If there are more than 4 family members, you can use the Math.max() function.