1. Declare and initialize an empty multidimensional array. (Array of arrays)
Question 2
2. Declare and initialize a multidimensional array
representing the following matrix:
Question 3
3. Write a program to print numeric counting from 1 to 10.
Question 4
4. Write a program to print multiplication table of any
number using for loop. Table number & length should be
taken as an input from user.
Question 5
5. Write a program to print items of the following array
using for loop:
fruits = [“apple”, “banana”, “mango”, “orange”,
“strawberry”]
Question 6
6. Generate the following series in your browser. See
example output.
a. Counting: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
b. Reverse counting: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
c. Even: 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20
d. Odd: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19
e. Series: 2k, 4k, 6k, 8k, 10k, 12k, 14k, 16k, 18k, 20k
Question 7
7. You have an array
A = [“cake”, “apple pie”, “cookie”, “chips”, “patties”]
Write a program to enable “search by user input” in an
array.
After searching, prompt the user whether the given item is
found in the list or not. Example:
Question 8
8. Write a program to identify the largest number in the
given array.
A = [24, 53, 78, 91, 12].
Question 9
9. Write a program to identify the smallest number in the
given array.
A = [24, 53, 78, 91, 12]
Question 10
10. Write a program to print multiples of 5 ranging 1 to
100.
Chapter No 21 to 25
Question 1
1. Write a program that takes two user inputs for first and
last name using prompt and merge them in a new variable
titled fullName. Greet the user using his full name.
Question 2
2. Write a program to take a user input about his favorite
mobile phone model. Find and display the length of user
input in your browser
Question 3
3. Write a program to find the index of letter “n” in the word
“Pakistani” and display the result in your browser .
Question 4
4. Write a program to find the last index of letter “l” in the
word “Hello World” and display the result in your browser.
Question 5
5. Write a program to find the character at 3rd index in the
word “Pakistani” and display the result in your browser
Question 6
6. Repeat Q1 using string concat() method.
Question 7
7. Write a program to replace the “Hyder” to “Islam” in the
word “Hyderabad” and display the result in your browser.
Question 8
8. Write a program to replace all occurrences of “and” in the
string with “&” and display the result in your browser.
var message = “Ali and Sami are best friends. They play cricket and
football together.”;
Question 9
9. Write a program that converts a string “472” to a number
472. Display the values & types in your browser
Question 10
10. Write a program that takes user input. Convert and
show the input in capital letters.
Question 11
11. Write a program that takes user input. Convert and
show the input in title case.
Question 12
12. Write a program that converts the variable num to
string.
var num = 35.36 ;
Remove the dot to display “3536” display in your browser.
Question 13
11. Write a program that takes user input. Convert and
show the input in title case.
Question 14
14. You have an array
A = [cake”, “apple pie”, “cookie”, “chips”, “patties”]
Write a program to enable “search by user input” in an
array. After searching, prompt the user whether the given
item is found in the list or not.
Note: Perform case insensitive search. Whether the user
enters cookie, Cookie, COOKIE or coOkIE, program
should inform about its availability. Example:
Question 15
15. Write a program to take password as an input from
user. The password must qualify these requirements:
a. It should contain alphabets and numbers
b. It should not start with a number
c. It must at least 6 characters long
If the password does not meet above requirements,
prompt the user to enter a valid password.
For character codes of a-z, A-Z & 0-9, refer to ASCII
table at the end of this document.
Question 16
16. Write a program to convert the following string to an
array using string split method.
var university = “University of Karachi”;
Display the elements of array in your browser.
Question 17
15. Write a program to take password as an input from
user. The password must qualify these requirements:
a. It should contain alphabets and numbers
b. It should not start with a number
c. It must at least 6 characters long
If the password does not meet above requirements,
prompt the user to enter a valid password.
For character codes of a-z, A-Z & 0-9, refer to ASCII
table at the end of this document.
Chapter no 21 to 25 all questions complete Question no 15 not understand its complete by the help of
chatgpt
Chapter No 26 to 30
Question 1
1. Write a program that takes a positive integer from user &
display the following in your browser.
a. number
b. round off value of the number
c. floor value of the number
d. ceil value of the number
Chapter No 26 to 30
Question 2
2. Write a program that takes a negative floating point
number from user & display the following in your browser.
a. number
b. round off value of the number
c. floor value of the number
d. ceil value of the number
Chapter No 26 to 30
Question 3
3. Write a program that displays the absolute value of a
number.
E.g. absolute value of -4 is 4 & absolute value of 5 is 5
Chapter No 26 to 30
Question 4
4. Write a program that simulates a dice using random()
method of JS Math class. Display the value of dice in your
browser.:
Chapter No 26 to 30
Question 5
Question no 5. Write a program that simulates a coin toss using random()
method of JS Math class. Display the value of coin in your browser
Chapter No 26 to 30
Question 6
Question no 6. Write a program that shows a random number between 1 and 100 in your browser.
Chapter No 26 to 30
Question 7
7. Write a program that asks the user about his weight. Parse
the user input and display his weight in your browser.
Possible user inputs can be:
a. 50
b. 50kgs
c. 50.2kgs
d. 50.2kilograms
Chapter No 26 to 30
Question 8
8. Write a program that stores a random secret number from
1 to 10 in a variable. Ask the user to input a number
between 1 and 10. If the user input equals the secret
number, congratulate the user.
Chapter No 31 to 34
Question 1
1. Write a program that displays current date and time in
your browser.
Chapter No 31 to 34
Question 2
2. Write a program that alerts the current month in words.
For example December.
Chapter No 31 to 34
Question 3
3. Write a program that alerts the first 3 letters of the current
day, for example if today is Sunday then alert will show
Sun.
Chapter No 31 to 34
Question 4
4. Write a program that displays a message “It’s Fun day” if
its Saturday or Sunday today.
Chapter No 31 to 34
Question 5
5. Write a program that shows the message “First fifteen
days of the month” if the date is less than 16th of the month
else shows “Last days of the month”.
Chapter No 31 to 34
Question 6
6. Write a program that determines the minutes since
midnight, Jan. 1, 1970 and assigns it to a variable that
hasn't been declared beforehand. Use any variable you like
to represent the Date object.