200 likes | 373 Views
Internet and Web Application Development. Revision. Revision. What is the difference between Internet and The Word Wide Web ? Internet : a physical network connecting millions of computers using the same protocols for sharing/transmitting information (TCP/IP)
E N D
Revision • What is the difference between Internet and The Word Wide Web ? • Internet : a physical network connecting millions of computers using the same protocols for sharing/transmitting information (TCP/IP) • in reality, the Internet is a network of smaller networks • World Wide Web: a collection of interlinked multimedia documents that are stored on the Internet and accessed using a common protocol (HTTP) 2. Give 3 examples of Internet-based applications email, telnet, ftp, instant messaging services, file-sharing services Web
Revision 3. Why do we use CSS in html? • HTML was never meant to be a presentation language. • CSS removes the presentation attributes from the structure allowing reusability, ease of maintainability, and an interchangeable presentation layer. • CSS allows us to make global and instantaneous changes easily. 4. Write a CSS code to change the body background-color, the color and text-align of the large bold heading (h1), the font-family and font-size of all paragraphs Web
Revision <html> <head> <style> body { background-color:#d0e4fe; } h1 { color:orange; text-align:center; } p { font-family:"Times New Roman"; font-size:20px; } </style> </head> <body> <h1>CSS example!</h1> <p>This is a paragraph.</p> </body> </html> Web
Revision 5. What file extension should CSS files have? .css 6. Which tag is used to create paragraphs? < p > 7. Which attribute is used to set inline styles for tags? style 8. PHP server scripts are surrounded by delimiters, which? <?php ?> 9. How do you write "Hello World" in PHP echo "Hello World"; Web
Revision 10. Where in an HTML document is the correct place to refer to an external style sheet? In the <head> section 11. All variables in PHP start with which symbol? $ 12. What is the correct way to end a PHP statement? ; 13. How do you get information from a form that is submitted using the "get" method? $_GET[]; Web
Revision 14. Which HTML tag is used to define an internal style sheet? <style> 15. Which CSS property controls the text size? font-size 16. Which property is used to change the font of an element?font-family 17. What is the correct way to create a function in PHP? function myFunction() 18.What is the correct way to connect to a MySQL server? mysql_connect(host,username,password); 19. What is the correct way to add 1 to the $count variable? $count++; Web
Revision 15. Which SQL statement is used to extract data from a database? SELECT 16. Which SQL statement is used to delete data from a database? DELETE 17. Inside which HTML element do we put the JavaScript? <script> 18. Where is the correct place to insert a JavaScript? Both the <head> section and the <body> section are correct 19. What is the correct syntax for referring to an external script called "xxx.js"? <script src="xxx.js"> Web
Revision 20. What is the difference between the Alert Box and the Confirm Box in javascript? • An alert box is often used if you want to make sure information comes through to the user. • When an alert box pops up, the user will have to click "OK" to proceed. • A confirm box is often used if you want the user to verify or accept something. • When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. • If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false. Web
Revision 21. What is the result of the following code? <html> <head> <script> function myFunction() { var x="",i; for (i=0;i<5;i++) { x= "The number is " + i + "<br>"; document.write(x); } } </script></head> <body> <p>Click the button to loop through a block of code five times.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> </body> </html> Web
Revision When the user click on the button named “Try it” the following 5 lines will be displayed : The number is 0 The number is 1 The number is 2 The number is 3 The number is 4 Web
Revision 22. Transform the for LOOP into While LOOP <html><head> <script> function myFunction() { var x="",i=0; while (i<5) { x= "The number is " + i + "<br>"; document.write(x); i++; } }</script></head> Web
Revision 23. Give 3 javascript mouse events onmouseover/onmouseout - When the mouse passes over an elementonmousedown/onmouseup - When pressing/releasing a mouse buttononmousedown - When mouse is clicked: Alert which element 24. What will display the next code? <html> <body> <p id="demo">Click the button to sort the array.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.sort(); var x=document.getElementById("demo"); x.innerHTML=fruits; } </script> </body> </html> Web
Revision fruits.sort(); var x=document.getElementById("demo"); x.innerHTML=fruits; } </script> </body> </html> This code sort the table fruits and when the user click on the button “Try it”, the content of the table will be displayed in the screen. Web
Revision 25. Write a javascript code to display the current date ad time <html> <body> <script> var d=new Date(); document.write(d); </script> </body> </html> Web
Revision 26. What are the basic steps to Process Databases with PHP and MYSQL? • Connect to host server which has Mysql installed • Select a database • Form an SQL statement • Execute the SQL statement and (optionally) return a record set • Extract data from recordset using php • Close connection Web
Revision 27. Write a php code to connect to MYSQL and select the database named “university”. <?php $host = "127.0.0.1"; $username = "root"; $pswd = ""; $dbName = "university"; $con = mysql_connect($host, $username,$pswd); if (!$con){ die("Could not connect:" . mysql_error());} $db = @mysql_select_db($dbName,$con) or die(mysql_error()); if ($db) echo" now you use the university datebase"; ?> Web
Revision 28. Write a php code to create the table : Persons(FirstNamevarchar(15),LastNamevarchar(15), Age int ) <?php $host = "127.0.0.1"; $username = "root"; $pswd = ""; $dbName = “university"; $con = mysql_connect($host, $username,$pswd); if (!$con){ die("Could not connect:" .mysql_error());} $db = @mysql_select_db($dbName,$con) or die(mysql_error()); $sql = "CREATE TABLE Persons(FirstNamevarchar(15), LastNamevarchar(15), Age int )"; mysql_query($sql, $con); ?> Web
Revision 29. Write a php code to insert the following records in the table Persons: (“Ibrahim”, “Moncef”, 40) (“Mohamed”, “Salah”, 30) <?php $host = "127.0.0.1"; $username = "root"; $pswd = ""; $dbName = "mydb"; $con = mysql_connect($host, $username,$pswd); if (!$con){ die("Could not connect:" . mysql_error());} $db = @mysql_select_db($dbName,$con) or die(mysql_error()); mysql_query("INSERT INTO Persons VALUES (‘Ibrahim',‘Moncef',40)"); mysql_query("INSERT INTO Persons VALUES (‘Mohamed', ‘Salah', 30)"); mysql_close($con); ?> Web