0% found this document useful (0 votes)
23 views

J 1465

Question

Uploaded by

Leslie Qwer
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)
23 views

J 1465

Question

Uploaded by

Leslie Qwer
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/ 16

.

(Pages : 3) J -1465
Reg. No. :
.<
Name :

Fourth Semester B.C.A./B.Sc. Degree Examination, March 2020

Career Related FDR Under CBCSS

Group2(b)-Computer Applications/Computer Science

Core Course-CS 1444/CP 1443

PHP AND MYSQL

(2018 Admission)

Time: 3 Hours Max. Marks: 80

SECTION - A [Very Short Answer Type]

(Answer all questions. Each question carries 1 mark) f

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?

(10 x 1 =10 Marks)

P.T.O.
SECTION - B [Short Answer]

(Answer any eight questions. Each question carries 2 marks)

11. Differentiate between require and include?

12. Briefly explain the control structures in PHP.

13. What are the two methods to display text with a PHP script?

14. What is session? How to initiate a session in PHP?

15. What is the differences between $a != $b and $a !== $b?

1.6. Which function is used in PHP to check the data type of any variable?

17. How do you retrieve data from the database?

18. What are the advantages of MySQL?

19.: What happens when an AUTO INCREMENT column reach maximum value in
the table?

20. What do you mean by % and - in the LIKE statement?

21. What is the different between NOW() and CURRENTJDATE ()?

22. Which MySQL function is used to concatenate string? Explain with example.

(8 x 2 = 16 Marks)
SECTION - C [Short Essay]

(Answer any six questions. Each question carries 4 marks)

23: What is the difference between indexed and associative array?

24. What is the difference between GET and POST methods in PHP?

25. Explain setcookie() function in PHP.

J -1465
26. What are the different privileges for users in MySQL?

27. Explain the DDL commands 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?

30. How to set up a connection with MySQL in RHP?

,31. What are the functions used for sorting arrays in RHP?

(6x4 = 24 Marks)
SECTION-D

(Answer any two questions. Each question carries 15 marks)

32.. Explain various data types available in RHP.

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. .

35. Explain the DML commands in MySQL with examples.

(2 x 15 = 30 Marks)

3 J -1465
4

f
r

t
(:

S'
i* *
. -•*

For Office Use Only


No.of i Question Paper Code
Copies
■3~- /f6 S'

V.
Remarks on Scrutiny

•v’

:^
. a -y c n

No. of'pages Page No.

FOURTH SEMESTER BCA/B.Sc. DEGREE EXAMINATIO


CAREER RELATED FDP UNDER CBCSS^
~o-
Group2(b)- COMPUTER APPLICATIONS/COMPUTER SCIENCE

Core Course- CS 1444/CP 1443


PHP and MYSQL

(2018 Admission)

rime:3 Hours Maximum Marks: 80

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)

Section A [Very Short Answer Type]

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.

Section B [Short Answer]

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

Syntax The syntax for if... then... else is;


<?php
if (condition is true) {
block one
else
block two
}
?>

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.

It has the following basic syntax.

<?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 C [Short Essay]

23. Indexed array: an array with a numeric key.


Associative array: an array where each key has its specific value.
Briefly explain the two types.
24. Both GET and POST method is used to transfer data from client to server in HTTP
protocol but Main difference between POST and GET method is that GET carries
request parameter appended in URL string while POST carries request
parameter in message body which makes it more secure way of transferring data
from client to client.
25. The setcookieQ function defines a cookie to be sent along with the rest of the
HTTP headers. A cookie is often used to identify a user. A cookie is a small file
that the server embeds on the user's computer. Each time the same computer
requests a page with a browser, it will send the cookie too.
26. Briefly explain how to grant privilege using GRANT option and how to revoke it
using REVOKE option. Write briefly about various privileges for database
operations.
27. Briefly explain CREATE, DROP, TRUNCATE, ALTER commands.
28. Briefly explain the two methods to embed PHP code in an HTML page:
Method-1:
<?php —- ?>
Method-2:
<? ?>
29. What are MySQL triggers and how are they used?
30. Connection to MySQL database is done by the use of mysqli_connectQ function as
follows:
<!—?php $database = mysqli_connect("HOSr, "USER^NAME", "PASSWORD");
rciysRl*-Select_db($database,"DATABASE_NAME"); ?-->

31. The functions used for sorting arrays in PHP.


sortQ - sort arrays in ascending order.
rsortQ - sort arrays in descending order.
asortO ■ sort associative arrays in ascending order, according to the value.
ksortQ - sort associative arrays in ascending order, according to the key.

Section D

32. Various data types available in PHP.


PHP data types are used to hold different types of data or values. PHP supports 8
primitive data types that can be categorized further in 3 types:
Scalar Types
Compound Types
Special Types

PHP Data Types: Scalar Types


There are 4 scalar data types in PHP: Boolean, integer, float, string
PHP Data Types: Compound Types
I
' There are 2 compound data types in PHP: array, object
33. A Function is nothing but a 'block of statements' which generally performs a
specific task and can be used repeatedly in our program.
User defined functions:
PHP supports user defined functions, where we can define our own functions. A
function doesn’t execute when it is defined, it executed when it is called.

<?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.

You might also like