-->

PHP and JS lab works questions



Following are the questions for JS and PHP. Write the answers and submit as lab report.

--------------------------------------------------------------------------------------------




Lab session/works:- JS


  1. write a JS program to display date and time. [Use Date() object]]
  2. Write a program to input a number and know that it is an even or odd number. [Use prompt for input and % operator to get remainder]
  3. Write a program to pick the greatest number among three numbers entered by the user.
  4. Write a Js program to find the square root of a number.Here the number is entered by the user.[Use Math object with method (Math.sqrt for square root) and prompt method to input data]
  5. Write a program to input your name and age using form and know whether he/she is eligible to vote or not. [ Use function and onclick event]
  6. Write a program to input a string using form and convert that into uppercase.[Use string object toUpperCase()]
  7. Write a program to print 1,3,5,....100 using a while loop. Use function.
  8. Write a program to reverse a string. [use loop from its length-1 to 0 and print it]
  9. An array contains some string data. Print them.
  10. An array contains some data. Print them in reverse order.[use array.reverse() method].
  11. Write a program to insert a string “We are learning JS” via form object getElementById() method.Use paragraph with id.
  12. Input your name and grade using form. Validate this with a message ‘This field is required’, onclick.
  13. Write any two paragraphs in your html page. Now write a program using jquery to hide that written paragraphs as you click on that.
  14. Use Jquery to create an alert message for a button.
  15. Use Jquery to show concept of slide effect.[Use slide() method]




PHP:-


  1. Write a PHP program to find the greatest number among three numbers.
  2. Write a PHP program to find the smallest number among three numbers.
  3. Write a PHP program to swap two numbers.
  4. Write a PHP program to input name and address using form and display them.
  5. Write a PHP program to input a string through a text box and find its length.[use strlen()]
  6. Write a PHP program to store some strings in an array and print them.
  7. Write a PHP program to sort data stored in an array.[use sort() function and print_r() to print.]
  8. Write a PHP program to know whether two strings are the same or not.
  9. Write a php program to display your name 100 times.
  10. Write a PHP program to print a multiplication table of a number.Input the number via form.
  11. Write a php program to display the factorial value of a number.
  12. Write a PHP program to connect a database named ‘student’.
  13. Write a PHP program to insert a record in a database named student with fields id,name and grade.
  14. Write a PHP program to display all records(previous question) of students who are in grade 11.
  15. Write a PHP program to delete records of a student whose id is 3.[previous question]

No comments:

Post a Comment