Wednesday, 30 March 2016

Store student details into XML file

Code:

<?php
$xml=new DomDocument("1.0","UTF-8");
$student=$xml->createElement("student");
$student=$xml->appendChild($student);
$dept=$xml->createElement("dept");
$dept=$student->appendChild($dept);
$ID=$xml->createElement("ID","001");
$ID=$dept->appendChild($ID);
$name=$xml->createElement("Name","Dominic Toretto");
$name=$dept->appendChild($name); 
$xml->FormatOutput=true;
$string_value=$xml->saveXML();
$xml->save("MyXml.xml");
?>
<meta http-equiv="refresh" content="1,url=MyXml.xml">

Output:

 

Sunday, 27 March 2016

PHP Questions

Some question of PHP programs are given below as  links. Click on that link which one you want to know more. The given links will display the program code and its output in a PDF. If you want to check the program code, just copy and paste into a text editor and then run it.

Questions are given below. Click on that to get answers, 
  1. Write a PHP program to print even numbers in a range?
  2. Write a PHP program to print prime numbers in a range?
  3. Write a PHP program to print Fibonacci numbers in a range?
  4. Write a PHP program to print n prime numbers?
  5. Write a PHP program to print n strange numbers?
  6. Write a PHP program to print n Fibonacci number?
  7. Write a PHP program to demonstrate switch control statement?
  8. Write a PHP program to concatenate two strings?
  9. Write a PHP program to display elements in an array in ascending order?
  10. Create a program to display whether a given number is a perfect, abundant or deficient? 
  11. Write a program to check a given number is prime or not? 
  12. Write a PHP program to display elements in an array using foreach loop?
  13. Write a PHP program to find largest in an array?
  14. Write a PHP program to demonstrate five string functions?
  15. Write a PHP program to read and display the contents of XML file?
  16. Create a program to populate content of XML file to dropdown list?
  17. Write a program to check a given number is strange or not? 
  18. Write a PHP program to demonstrate use of Cookie?
  19. Create a loginform and logout page?
  20. Create an HTML form and post its value to another page in PHP?
  21. Write a PHP program to demonstrate Class and Object? 
  22. Write a PHP program to demonstrate Inheritance?
  23. Write a PHP program to display root of quadratic equation by accepting coefficients?
  24. Write a PHP program to demonstrate Constructor and Destructor?
  25. Write a PHP program to create login form with session? 
  26. Write a PHP program to demonstrate function overriding? 
  27. Write a PHP program to populate dropdown list with data from MySQL table? 
  28. Write a PHP program to search an element in array using linear search? 
  29. Write a php program to populate content of student table to HTML? 
  30. Write a program to create XML file and store student details?

JAVA Questions

Some question of Java programs are given below as a link. Click on that link which one you want to know more. The given links will display the program code and its output. Here I displayed the output as an Image. Check its working by copying that codes to a Notpad or any text editors and then save as a JAVA file.

Questions are given below. Click on that to get answers,
  1. Write a java program to find area and circumference of a circle?
  2. Write a java program to calculate electricity bill by reading the consumer no and no of units consumed. The charges for different slabs are given below
    up to 50 unitsRs 1.5 per unit
    50-100 unitsRs 2 per unit
    100-200 unitsRs 2.8 per unit
    200-300 unitsRs 3.5 per unit
    above 300 unitsRs 4.50 per unit
  3. Write a java program to  display n prime numbers?
  4. Write a java program to display Fibonacci series up to n?
  5. Write a java program to check whether a given year is leap or not?
  6. Write a java program to display the Armstrong within range?
  7. Write a java program to check whether a given number is perfect, abundant, or deficient?
  8. Write a java program to check whether the given sides can form a triangle. If yes,find area of the triangle?
  9. Write a java program to find the roots of a quadratic equation?
  10. Write a java program to compute the mean and SD of 3 numbers. Mean=(a+b+c)/3, SD=√((a-m)²+(b-m)²+(c-m)²)/3
  11. Write a java program to read an array of 10 numbers and to find the following,
    a. Sum of the elements
    b. Average of the elements
    c. Maximum of the elements
    d. Minimum of the elements
     
  12. Write a java program to sort an array?
  13. Write a java program to count the number of even numbers, odd numbers, positive numbers, negative numbers and zeros in an array?
  14. Write a java program to appending two arrays?
  15. Write a java program to find the sum of the digits and reverse of a given number using class and objects?
  16. Write a java program to find the volume of cube, rectangular box, cylinder using function overloading?
  17. Write a java program to create a class complex. Create two objects find the sum of the complex numbers, Read the real and imaginary part using constructor?
  18. Find the area of a square and a rectangle using overloaded constructor?
  19. Write a java program to enable arithmetic exceptions?
  20. Write a java program for generating two threads. One for odd numbers and one for even numbers?

JavaScript Questions


Some question of JavaScript programs are given below as links. Click on that link which one you want to know more. The given links will display the program code and its output. Here I displayed the outputs as Images. If you want to check its working, copy that code to a Notepad or any text editors and then save as a HTML file.

Questions are given below. Click on that to get answers,
  1. Write a JavaScript program to find the area and circumference of a circle?
  2. Write a JavaScript program to show the Alert Box?
  3. Write a JavaScript program to store different colors in an array and change the background color of the page using this array elements?
  4. Write a JavaScript program for form validation?
  5. Write a JavaScript program to print first n even numbers?
  6. Write a JavaScript program to print first n prime numbers?
  7. Write a JavaScript program to print first n Fibonacci numbers?
  8. Write a JavaScript program to print prime numbers in a range?
  9. Write a JavaScript program to perform case conversion?
  10. Write a JavaScript program to alert content of text box?
  11. Write a JavaScript program to illustrate onMouseOver event?
  12. Write a JavaScript program to illustrate onKeyup event?
  13. Write a JavaScript program to print strange numbers in a range?
  14. Write a JavaScript program to print fibonacci numbers in a range?

HTML Questions

Some question of HTML programs are given below as links. Click on that link which one you want to know more. The given links will display the program code and its output. Here I displayed the outputs as images. If you want to check its working, Copy that codes to a Notepad or any text editors and then save as an HTML file.

Questions are given below. Click on that to get answers, 

  1. Create an HTML page which contains 6 heading and 6 formatting tags?
  2. Create an HTML page with 3 type (ordered, unordered and definition) list element tags?
  3. Create an HTML page which display all alignment option of an image?
  4. Create an HTML page with external and internal link?
  5. Create an HTML page with a table which contain column span, row span and background color?