0% found this document useful (0 votes)
16 views13 pages

1565586552032-PHP Paper 3

The document contains a series of multiple-choice questions and answers related to web technologies, including HTML, CSS, PHP, and XML. It also includes sections for short notes on specific topics and coding tasks to demonstrate understanding of web development concepts. Additionally, it outlines mistakes in PHP code and requests corrections, indicating a focus on practical application and problem-solving in web programming.

Uploaded by

tdilshan00054
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views13 pages

1565586552032-PHP Paper 3

The document contains a series of multiple-choice questions and answers related to web technologies, including HTML, CSS, PHP, and XML. It also includes sections for short notes on specific topics and coding tasks to demonstrate understanding of web development concepts. Additionally, it outlines mistakes in PHP code and requests corrections, indicating a focus on practical application and problem-solving in web programming.

Uploaded by

tdilshan00054
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

1. XML stands for?

A. Extra Markup Language


B. Excavational Markup Language
C. Extensible Markup Language
D. None of these

2. Which of the following tag is used to mark a beginning of body?


A. <td>
B. <br>
C. <body>
D. <tr>

3. Correct HTML tag for the smallest heading is


A. <head>
B. <h6>
C. <heading>
D. <h1>

4. The latest PHP standard is


A. PHP 6
B. PHP 5
C. PHP 8
D. PHP 7

5. Markup tags tell the web browser


A. How to organize the page
B. How to display the page
C. How to display message box on page
D. None of these

6. What does acronym TCP stand for in the standard Internet protocol suit?
A. Transmission Control Protocol
B. Transfer Control Protocol
C. Transfer Control Program
D. None of these

7. Which of the following code segment(s) will correctly add a hidden field to a form?
A. <input type="hidden" name="hidden_name" value="hidden_value" visible="false">
B. <input type="hidden" name="hidden_name" value="hidden_value">
C. <input type="text" name="hidden_name" property="hidden" value="hidden_value">
D. <input type="hiddentext" name="hidden_name" value="hidden_value">

8. XML creates for


A. Validate data
B. Abstract data from server
C. Store and transport data
D. None of these

9. Which of the following statement(s) is/are true with respect to XML


A. XML is platform independent
B. XML provides a customized tag to format and display textual information
C. XML allows only for data sharing within the same application.
D. XML focuses on presenting data similar to HTML.
10. What is default port number for FTP
A. 80
B. 21
C. 25
D. 8080

11. What is the correct HTML for referring to an external style sheet?
A. <stylesheet>style.css</stylesheet>
B. <style src="style.css">
C. <link rel="stylesheet" type="text/css" href="style.css">
D. <link rel="cascadingstylesheet" type="css" href="style.css">

12. Which of the following HTML code segments can be used to embed a video in an HTML page?
A. <media src="IJTS.avi" width= "640" height= "480">
B. <object data= "IJTS.avi" type= "video/avi" width= "640" height= "480">
C. <embed src="IJTS.avi" width= "640" height= "480">
D. <media data= "IJTS.avi" type= "video/avi" width= "640" height= "480">

13. Which of the following method sends input to a script via the body?
A. Get
B. Post
C. Both
D. None

14. Which of the following CSS code(s) will add a background image to the body of an HTML document
A. body { bgimage: src="backgroundimage.png" }
B. body { background-image: url("backgroundimage.png"); }
C. body { background-image: src="backgroundimage.png" }
D. body { background: href="backgroundimage.png" }

15. Which of the following attributes is/are available for the IMG tag?
A. src
B. lang
C. width
D. usemap

16. What will be the output of the following PHP code?


A. Error
B. 0
C. 42
D. 84

17. Which of the following are valid function names?


i) function()
ii) €()
iii) .function()
iv) $function()

A. Only ii)
B. None of the mentioned.
C. All of the mentioned.
D. iii) and iv)

18. What will be the output of the following PHP code?

A. I am b
B. I am bI am a
C. Error
D. I am a Error

19. What will be the output of the following PHP code?


A. I am b
B. I am bI am a
C. Error
D. I am a Error

20. What will be the output of the following PHP code?

A. helloblabla
B. Error
C. hello
D. helloblablablabla

21. What will be the output of the following PHP code?

A. 5 === 5
B. Error
C. 1
D. False

22. Which of the conditional statements is/are supported by PHP?


i) if statements
ii) if-else statements
iii) if-elseif statements
iv) switch statements

A. Only i)
B. i), ii) and iv)
C. ii), iii) and iv)
D. All of the mentioned.
23. PHP’s numerically indexed array begin with position __.
A. 1
B. 2
C. 0
D. -1

24. The _________ property is mostly used to remove underline from links
A. text-trans
B. text-transformation
C. text-decoration
D. text-deco

25. Which of the following statement(s) is/are true with respect to Cascading Style Sheets?
A. Multiple columns of text can be added to web pages by using CSS.
B. Floating boxes are not allowed in CSS.
C. Images as borders are not allowed in the CSS box-model.
D. CSS box-model allows the creation of rectangular boxes in HTML documents.
SECTION B

Answer all Questions.

1. Briefly explain and write short notes for any five out of seven questions.

A. Cookies in PHP
B. GET and POST
C. cPannel
D. Difference between Static web pages and Dynamic ones.
E. XML DTD.
F. XSLT
G. CSS Inline, External and Internal

2. Write HTML codes generate following designs.


A. Develop below by using HTML table tags

B. Develop below by using HTML list tags without using CSS.


3.
A. In relation to Web technologies consider following terms, expand and briefly describe
the role they play with an examples.
i. HTML
ii. CSS
iii. PHP
iv. MySQL

B. Show the relationship between the technologies in part A. using a sketch of a client-server
model that shows where each of the above technologies reside and the connections
between them.

4.
A. Suppose you have to make a dynamic website. The login page of the website asks the
username and password as shown below. Consider the following design and write HTML
coding to implement following design. Once a user presses the Login button, the form
action will be submitted to loginaction.php.
Tip for high marks: Use table tag and Ignore sample values in Text boxes.

B. The PHP code of that page validates the user against usernames and passwords in a
database. If that user is a valid user, system creates a session and redirects the user to
home.php. Otherwise, the page displays the message “You are a invalid user”. You can
find the implementation of loginaction.php at the end of this paper, but loginaction.php
consists with mistakes. Note: line numbers only for your reference and those are not a
part of coding.

The page produces the following output.


You are a invalid user Warning: Cannot modify header information - headers already sent
by in loginaction.php on line 22.

i. List down the mistakes and correct those mistakes (indicate the line numbers of
code where appropriate). As an example one is done for you.

Line number 01 : require_onced 'dbconnection.php'; should be


require_once 'dbconnection.php';
ii. In addition to that, if a user who has already signed in tries to access this page,
such user has to be automatically redirected to home.php. Give the PHP code for
this functionality.

****
PART A (MCQ) - :

No Answer No Answer No Answer


1 C 11 C 21 C
2 C 12 C 22 D
3 B 13 B 23 C
4 D 14 B 24 C
5 B 15 A,C 25 A,D
6 A 16 A,C
7 B 17 B
8 C 18 D
9 A,C 19 C
10 B 20 B,C

PART B -:

1.

A. Cookies are text files stored on the client computer and they are kept of use tracking purpose. PHP transparently
supports HTTP cookies.

There are three steps involved in identifying returning users?

 Server script sends a set of cookies to the browser. For example name, age, or identification number etc.
 Browser stores this information on local machine for future use.
 When next time browser sends any request to web server then it sends those cookies information to the
server and server uses that information to identify the user.

B. The GET Method

The GET method sends the encoded user information appended to the page request. The page and the encoded
information are separated by the ? character.

http://www.test.com/index.htm?name1=value1&name2=value2

 The GET method produces a long string that appears in your server logs, in the browser's Location: box.
 The GET method is restricted to send upto 1024 characters only.
 Never use GET method if you have password or other sensitive information to be sent to the server.
 GET can't be used to send binary data, like images or word documents, to the server.
 The data sent by GET method can be accessed using QUERY_STRING environment variable.
 The PHP provides $_GET associative array to access all the sent information using GET method.
The POST Method

The POST method transfers information via HTTP headers. The information is encoded as described in case of
GET method and put into a header called QUERY_STRING.

 The POST method does not have any restriction on data size to be sent.

 The POST method can be used to send ASCII as well as binary data.

 The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By
using Secure HTTP you can make sure that your information is secure.

 The PHP provides $_POST associative array to access all the sent information using POST method.

C. cPanel is a popular control dashboard that helps you manage your web hosting server using a human-friendly web-
based interface. It’s especially popular with shared hosts, where it’s the de facto solution provided by most
affordable hosting providers. Without cPanel, you would need technical knowledge to manage your
websites/server. But with cPanel, you’re able to make changes using a graphical interface – no technical
knowledge required.

D. Static Web pages:

Static Web pages are very simple. It is written in languages such as: HTML, JavaScript, CSS, etc. For static web
pages when a server receives a request for a web page, then server sends the response to the client without doing any
additional process. And these web pages are seen through web browser. In static web pages, Pages will remain same
until someone changes it manually.

Dynamic Web Pages:

Dynamic Web Pages are written in languages such as: CGI, AJAX, ASP, ASP.NET, etc. In dynamic web pages,
Content of pages are different for different visitors. It takes more time to load than static web page. Dynamic web pages
are used where the information are changed frequently, for example: stock prices, weather information etc.

E. The XML Document Type Declaration, commonly known as DTD, is a way to describe XML language precisely.
DTDs check vocabulary and validity of the structure of XML documents against grammatical rules of appropriate
XML language.

F. XSLT, Extensible Stylesheet Language Transformations, provides the ability to transform XML data from one
format to another automatically. An XSLT stylesheet is used to define the transformation rules to be applied on the
target XML document. XSLT stylesheet is written in XML format. XSLT Processor takes the XSLT stylesheet and
applies the transformation rules on the target XML document and then it generates a formatted document in the
form of XML, HTML, or text format. This formatted document is then utilized by XSLT formatter to generate the
actual output which is to be displayed to the end-user.

G. Inline Styles

An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute
to the relevant element. The style attribute can contain any CSS property.

External Style Sheet

With an external style sheet, you can change the look of an entire website by changing just one file. Each page
must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside
the <head> section.

Internal Style Sheet

An internal style sheet may be used if one single page has a unique style. Internal styles are defined within the
<style> element, inside the <head> section of an HTML page.
2.

A.

B.
3.

A.

i. Hyper Text Markup Language (HTML) is a markup language for creating a webpage. Webpages are
usually viewed in a web browser. They can include writing, links, pictures, and even sound and video.
HTML is used to mark and describe each of these kinds of content so the web browser can display them
correctly. HTML can also be used to add Meta information to a webpage. Meta information is usually
not shown by web browsers and is data about the web page, e.g., the name of the person who created the
page. Cascading Style Sheets (CSS) is used to style HTML elements while JavaScript is used to
manipulate HTML elements and CSS styles.

ii. Web browsers apply CSS rules to a document to affect how they are displayed. A CSS rule is formed
from:
 A set of properties, which have values set to update how the HTML content is displayed.
 A selector, which selects the element(s) you want to apply the updated property values to.

A set of CSS rules contained within a stylesheet determines how a webpage should look.

iii. When PHP receives the file it reads through it and executes any PHP code it can find. After it is done
with the file, the PHP interpreter gives the output of the code, if any, back to Apache. When Apache gets
the output back from PHP, it sends that output back to a browser which renders it to the screen.

iv. The heart of the system is the MySQL server. The MySQL server is the manager of the database system.
It handles all your database instructions. In the same manner, to add data to that database, you send a
message to the MySQL server, giving it the data and telling it where you want the data to be added.

B.
4.

A.

B.

i.

1. Line number 13 : password='$username'"; should be password='$password'";


2. Line number 22 : header('Location:home.php'); should be move after line number 19.

ii.

You might also like