Skip to content

Latest commit

 

History

History
147 lines (85 loc) · 4.07 KB

12-basic-test-exercise.md

File metadata and controls

147 lines (85 loc) · 4.07 KB

Question 1

Create Bill Calculator

Ask below questions:

  1. How many french fries (60rs per piece) do you want to order ?
  2. How many burgers (50rs per piece) do you want to order ?
  3. How many plates of chowmin (100rs per plate) do you want to order?
  4. How many plates of Manchurian (80rs per plate) do you want to order?
  5. How many Cokes (50 per piece) do you want to order ?

Use can enter any number of quantities. Calculate the bill based on the quantities entered and item prices. If user enteres 0 or negative value then consider item count as 0.

Question 2

Print below pattern:

$$#$$#$$
$$#$$#
$$#$$
$$#
$$

Question 3

Ask the user question "How many times do you want to print Series". Then print below series. For example below series will print if user enteres 5:

1 2 3 5 8 13 21 34 55

Find the pattern for above series and print accordingly. If the user enters 10 then we will print the same series numbers till 10 times.

Question 4

Using a switch case to do this exercise.

Ask user a question "Do you drink tea/coffee" ?

  • If user says tea print tea.
  • If user says coffee then print coffee.
  • If users say anything else then print water.

Question 5

Ask user his/her age, "What is your age?"

If user age is greater than 18 and less than 50 then ask user "Would you like to have a coffee?" If user click on "Okay" button then ask for his/her choice with questions "What type of coffee you want to have?" and finally in the alert show message "Hello Sir/Mam, here is your coffee ###"

If user age is less than 18 then ask him question in confirm box "Would you like to have tea?" If user says yes then ask "What type of tea do you want?" and then in alert show "Hello Sir/Mam, here is your ### tea." Else show "Sorry visit again please." in alert box

Question 6

Take any number and take other number as 39. Now check their difference by subtracting each other. If both numbers difference is greater than 40 then print double their absolute difference else print triple of their absolute difference.

Question 7

Write a JavaScript program to check from two given integers, whether one is greater than 18 and another one is less than 10.

If yes then print sum of both the numbers. Else print multiplication of both numbers.

Question 8

Write a JavaScript program to check if out of 5 numbers any two numbers are same or not. If yes then print "Yes" else print "No".

Question 9

Write a program to check if a number is divisible by 10 && 20 or not. If yes then multiply the number by 51 else multiply the number by 59 and print.

Question 10

Take a String and check its length. If string length is greater than 15 then print 2's table till the length of the string else print "No".

Question 11

How do you reverse a given string in place?

Question 12

How do you print duplicate characters from a string?

Question 13

How do you find duplicate characters in a given string?

Question 14

How do you count a number of vowels and consonants in a given string?

Question 15

How do you check if a given string is a palindrome?

Question 16

Given a string, How do you find the longest palindromic substring in string?

Question 17

How to remove the duplicate character from String?

Question 18

Write a program to count the number of characters in a string.

Question 19

Write a program to check if a given string is a palindrome (reads the same backwards and forwards).

Question 20

Write a program to reverse a string.

Question 21

Write a program to find the first non-repeated character in a string.

Question 22

Write a program to remove all vowels from a string.

Question 23

Write a program to check if a given string contains only numeric characters.

Question 24

Write a program to find the largest word in a string.

Question 25

Write a program to remove all occurrences of a particular character from a string.

Question 26

Write a program to capitalize the first letter of each word in a sentence.

Question 27

Write a program to find the most frequently occurring character in a string.