J 1465
J 1465
(Pages : 3) J -1465
Reg. No. :
.<
Name :
(2018 Admission)
i
1. What is FTP?
2. Which tag is used to insert line„break in HTML code?
3. Howto set cookies in PHP?
4. What is DHTML?
5. What is a dynamic website?
6. How to do single line comments in PHP?
7. What is “print” in PHP?
8. What is the default file extension of PHP?
9. How to include a file to a PHP page?
10. What is database management system?
P.T.O.
SECTION - B [Short Answer]
13. What are the two methods to display text with a PHP script?
1.6. Which function is used in PHP to check the data type of any variable?
19.: What happens when an AUTO INCREMENT column reach maximum value in
the table?
22. Which MySQL function is used to concatenate string? Explain with example.
(8 x 2 = 16 Marks)
SECTION - C [Short Essay]
24. What is the difference between GET and POST methods in PHP?
J -1465
26. What are the different privileges for users in MySQL?
28, In how many ways can you embed RHP code in an HTML page?
29. What are MySQL triggers and how are they used?
,31. What are the functions used for sorting arrays in RHP?
(6x4 = 24 Marks)
SECTION-D
33. Briefly explain about user defined and built-in functions in RHP.
34. Explain the DDL commands in MySQL with examples. Show how to implement .
constraints like primary key, foreign key, not null and check 'constraints in
MySQL. .
(2 x 15 = 30 Marks)
3 J -1465
4
f
r
t
(:
S'
i* *
. -•*
V.
Remarks on Scrutiny
•v’
:^
. a -y c n
(2018 Admission)
Answer Key
I
L
Set-2_Answer Key
•fourth SEMESTER BCA/ B.Sc. degree examinations
CAREER RELATEDFDP UNDER CBCSS
Group 2(b)- COMPUTER APPLICATIONS/COMPUTER SCIENCE
Core Course- CS 1444/CP 1443
PHP and MYSQL
(2018 Admission)
1. File Transfer Protocol (FTP) is a client/server protocol used for transferring files
to or exchanging files with a host computer.
2. <br>
3. To set a cookie in PHP, the setcookieQ function is used. The setcookieQ function
needs to be called prior to any output generated by the script otherwise the cookie
will not be set. Syntax: setcookie(name, value, expire, path, domain, security);
4. Dynamic HTML, or DHTML, is a collection of technologies used together to create
interactive and animated websites by using a combination of a static markup
language (such as HTML), a client-side scripting language (such as JavaScript), a
presentation definition language (such as CSS)
5. Dynamic websites contain Web pages that are generated in real-time. These pages
include Web scripting code, such as PHP or ASP. When a dynamic page is accessed,
the code within the page is parsed on the Web server and the resulting HTML is
sent to the client’s Web browser.
6. To do a single line comment type"//" or and all text to the right will be ignored
by PHP interpreter.
7. Print function in PHP is used to display the outputs in the browser. This function
returns the Boolean value true. We cannot print the multiple statements using this
function. The print function plays the same role as the echo function.
8. .php
9. The include(or require) statement takes all the text/code/markup that exists in
the specified file and copies it into the file that uses the include statement.
Including files is very useful when you want to include the same PHP, HTML, or
text on multiple pages of a website.
10. A database management system (DBMS) is a software for creating and managing
databases. A DBMS makes it possible for end users to create, read, update and
delete data in a database. A DBMS is a computerised record keeping system.
11. The require and include functions do the same task, i.e. includes and evaluates the
specified file, but the difference is require will cause a fatal error when the
specified file location is invalid or for any error whereas include will generate a
warning and continue the code execution.
12. Control Structures in PHP:
9
9
IF Else
If... then... else is the simplest control structure. It evaluates the conditions
using Boolean logic
When to use if... then... else
You have a block of code that should be executed only if a certain
condition is true
You have two options, and you have to select one.
If... then... else if... is used when you have to select more than two options
and you have to select one or more
Switch Case
Switch... case is similar to the if then... else control structure.
It only executes a single block of code depending on the value of the
condition.
If no condition has been met then the default block of code is executed.
<?php
switch(condition){
case value:
//block of code to be executed
break;
case value2:
//block of code to be executed
break;
default:
//default block code
break;
}
?>
13. Echo and Print are the two methods of display text in a PHP script.
<!--?php echo "Method 1"; print "Method 2"; ?-->
14. Sessions are a simple way to store data for individual users against a unique
session ID. This can be used to persist state information between page requests.
Session IDs are normally sent to the browser via session cookies and the ID is
used to retrieve existing session data.
I
I
session.startQ creates a session or resumes the current one based on a session
identifier passed via a GET or POST request, or passed via a cookie. When
session_startQ is called or when a session auto starts, PHP will call the open and
read session save handlers.
15. $a != $b checks the value of $a is not equal to $b.
and $a !== $b checks the value of $a is matched with $b and also the type which
must be same. != means inequality (TRUE if $a is not equal to $b) and !== means
non-identity (TRUE if $a is not identical to $b).
16. The gettypeQ function is an inbuilt function in PHP which is used to get the type
of a variable. It is used to check the type of existing variable.
17. Data can be retrieved from database using DML statements in SQL.
18. There are several advantages of MySQL which are making it a more popular
database system now.
Some significant advantages and disadvantages of MySQL are mentioned below.
Advantages:
• It is well-known for its reliable and secure database management system.
Transactional tasks of the website can be done more securely by using
this software.
• It supports different types of storage engines to store the data and it
works faster for this feature.
• It can handle millions of queries with a high-speed transactional process.
• It supports many advanced level database features, such as multi-level
transactions, data integrity, deadlock identification, etc.
• Maintenance and debugging processes are easier for this software.
19. It stops incrementing. Any further inserts are going to produce an error, since
the key has been used already.
20. % corresponds to 0 or more characters, _ is exactly one character in the LIKE
statement.
21. NOW 0 command is used to show current year, month, date with hours, minutes
and seconds.
CURRENT_DATEQ shows current year, month and date only.
22. MySQL CONCATQ function is used to add two or more strings.
CONCAT (stringl, string2,...). CONCAT0 function is used to combine two or more
string data. The use of this function is here with an example.
Example:
The following SELECT query with CONCATQ function will combine five words,
'Welcome', 'to', 'SoftwareTestingHelp',7 and 'com'.
SELECT CONCAT(‘Welcome ‘,to VSoftwareTestingHelpV.^com');
I
I
»•*
Section D
<?php
function function_name()
{
// function code statements
}
?>
Built-in Function: A function that is built into an application and can be accessed
by end-users. For example, most spreadsheet applications support a built-in SUM
function that adds up all cells in a row or column.
34. Briefly explain the DDL commands such as CREATE, DROP, ALTER, TRUNCATE,
etc. Write examples for each commands and use various constraints like PRIMARY
KEY, FOREIGN KEY, NOT NULL and CHECK constraints.
35. Briefly explain the following DML commands with examples:
SELECT, INSERT, DELETE, UPDATE.