TN Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 1.
What are buttons used in HTML Form controls?
Answer:
Buttons may contains submit button, Reset button and cancel button.

Question 2.
What is POST method?
Answer:
The input data sent to the server with POST method is stored in the request body of the client’s HTTP request.

Question 3.
What is GET method?
Answer:
The input data sent to the server with POST method via URL address is known as query string. All input data are visible by user after they clicks the submit button.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 4.
What are back-end application used in HTML?
Answer:
The back-end application are CGI. ASP script. ISP, PHP script etc.,

Question 5.
What purpose using ‘required’ attribute in HTML input tag?
Answer:
Before sending the data to serve side program, the programmer can write few validations from browser in the client machine. For this validation, we have to add additional ‘required’ attribute in HTML input tag.

Question 6.
How can we access the data sent through the URL with the GET method?
Answer:
To access the data sent via the GET method, we use $-GET array, that is $ variable = $_GET [“var”];

Question 7.
How can we access the data sent through the URL with the POST method?
Answer:
To access the data sent this way, you use the $_POST array, like this $_P.ast [“var”];

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 8.
How can we check the value of a given variable is a number?
Answer:
It is possible to use the dedicated function, is_numeric( ) to check, num or not.

Question 9.
How do I check if a given variable is empty?
Answer:
If we want to check whether a variable has a value or not, it is possible to use the empty () function.

Question 10.
What does $_SERVER mean?
Answer:
$_SERVER is an array including information created by the web server such as paths, headers, and script locations.

Question 11.
What does $_Files means?
Answer:
$_Files is an associate array composed of items sent to the current script via the HTTP POST method.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 12.
List the different tasks using files in PHP.
Answer:
Files are processed for different tasks using the following events:

  • PHP open a File
  • PHP read a File
  • PHP close a File
  • PHP write a File
  • PHP appending a file and
  • PHP uploading a file

Question 13.
Write a suitable example for client side validation.
Answer:
<input> required Attribute in HTML
<form action = “example.php”>
username:cinput type = “text”
name = “name” required>
<input type = “submit”>
</form>.
output like this:

TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files 1

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 14.
Write fwrite() function syntax with example in PhP.
Answer:
The write () function is used tb write to a file.
Syntax: fwrite (Smyfile.Stxt) ;
Eg:
<?PhP
$myfile = fopen (“new_school_file.txt, “w”)
or die (“unable to open file”) ;
$txt = “school’name\n”; fwrite (Smyfile, Stxt);
$txt = “student Name /n”;
fwrite (Smyfile, Stxt) ;
fclose. (Smyfile) ; >
?>

Question 15.
Write a PHP Basic form Handling script using HTML controls.
Answer:
<html>
<body>
cform action= “welcome.php” method= “post”> Name: <input type= “text” name= “name”><br> E-mail: <input type= “text” name= “email”xbr> <input type= “submit”>
</form>
</body>
</html>
Welcome.php:
<html>
<body>
Welcome <?php echo $_POST[“name”]; ?><br>
Your email address is: <?php echo $_POST[“email”]; ?> </body> .
</html>

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 16.
Write the validation rules for HTML input field.
Answer:
Validation Rules for the HTML input field are .

  1. Name (Text Input) – It should be require letters and white spaces.
  2. E-mail (Text Input) – It should be require @ and strings.
  3. Website (Text Input) – Should require a valid URL.
  4. Radio – Must be selected minimum one value.
  5. Check box – Must be checkable minimum one value.
  6. Drop Down menu – Must be selectable minimum one value.

Question 17.
Write various parameters used in PHP appending a file.
Answer:
Syntax: file_put_contents (file, data, mode, context)
Here, file, data, mode, context are parameters ‘ File – specifies the file to write to. If the file does not exist, this function will create one. (Required)
data – The data to write to the file can be a string, an array or a data stream. (Required) mode – specifies how to open/write to the file possible values (optional)
context – specifies the context of the file handle.
Context is a set of options that can modify the behaviour of a stream.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 18.
Explain validation and its types in PHP.
Answer:
Validation is a process of checking the input data submitted by the user from client machine.
There are two types of validation available in PHP. They are
(i) Client-side validation:
The input data validations are performed on the client machine’s web browsers using client side scripts like java scripts or adding “required” attribute in HTML input tags.

(ii) Server-side validation:
After the submission of data, validations are performed on the server side-using the programming like PHP, ASP or JSPetc., available in the server machine.

The HTML input field validation are Name (Text input), E-mail (Text input),
Website (Text input), Radio, check box and Drop down menu.
In client-side validation, before sending the data to server side program (PHP) fee programmer can write few validations from browser in the client machine.

For this validation, we have to add additional “required” attribute in HTML input tag.

Question 19.
PHP form validation with example – Explain.
Answer:
In PHP form validation, contains various input fields: required and optional text fields, radio buttons, and a submit button.

TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files 2

The validation rules for the form above are as follows^ (field with rules)]
Name – Required, Must contain letters and white spaces.
E-mail – Required, must contain a valid email address (with @ and)
Website – Optional, multi-line input field (text area).
Gender – Required, must select one.
HTML code for the form.
Welcome <?php echo $_POST[“name”]; ?><br>
Your email address is: <?php echo $_POST[“email”]; ?>
</body>
</html>

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 20.
Write the validation rules for HTML input field.
Answer:
Validation Rules for the HTML input field are

  1. Name (Text Input) – It should be require letters and white spaces.
  2. E-mail (Text Input) – It should be require @ and strings.
  3. Website (Text Input) – Should require a valid URL.
  4.  Radio – Must be selected minimum one value.
  5. Check box – Must be checkable minimum one value.
  6. Drop Down menu – Must be selectable minimum one value.

Question 21.
Write various parameters used in PHP appending a file.
Answer:
Syntax:
file_put_contents (file, data, mode, context)
Here, file, data, mode, context are parameters
File – specifies the file to write to. If the file does not exist, this function will create one. (Required)
data – The data to write to the file can be a string, an array or a data stream. (Required)
mode – specifies how to open/write to the file possible values (optional)
context – specifies the context of the file handle.
Context is a set of options that can modify the behaviour of a stream.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 22.
Explain validation and its types in PHP.
Answer:
Validation is a process of checking the input data submitted by the user from client machine.
There are two types of validation available in PHP.
They are
(i) Client-side validation:
The input data validations are performed on the client machine’s web browsers using client side scripts like java scripts or adding “required” attribute in HTML input tags.
Text fields:
The name, e-mail, and website fields are text input elements, and the comment field is a text area.
Name: <input type = “text”
name = “name”>
E-mail: <input type = “text”
name = “email”>
Website: <input type ‘= “text”
name= “website”>
comment: <text area name = “comment”
rows = “5” cols = “40” > </text area>

Radio Buttons:
Gender:
<input type = “radio” name = “gender”
value = “female” > female
<input type = “radio” name = “gender”
value = “male” > male
<input type = “radio” name = “gender”
value = “other” > other

Form element:
<form method = “post” action = “<?php
echo
html special chars ($_SERVER [“PHP_SELF”1); ? >”>

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 23.
Define HTML form controls.
Answer:

  1. HTML form controls are to collect data from users.
  2. In the web development, users access website or web pages from remote client machine and feed the data to server.
  3. These data are collected via HTML form controls like textbox, drop down box and radio button etc.

Question 24.
Define for Form Handling method in PHP.
Answer:

  1. In PHP form Handling method, when the user keying the input data in HTML controls and clicks the submit button the request will be generated and reaches a PHP file which is mentioned in the FORM tag under the Action Attribute.
  2. The two PHP variables such as $_POST and $_GET collects the data and prepares the response accordingly.

Question 25.
What is Form Validation in PHP?
Answer:
PHP Form validation is a process of checking the input data submitted by the user from client machine.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 26.
List out HTML control to support PHP language.
Answer:
The following HTML control to support PHP Language are;

  1. Text inputs
  2. Radio box
  3. Buttons
  4. File select
  5. Check box
  6. Forming.

Question 27.
Write Syntax of Text box in HTML.
Answer:
Syntax:
<input type = “text”>
Eg:
<form>
First name: <br>
<input type = “text”
name = “First name”> <br>
Last name: <br>
<input type = “text”
name = “Last name”>
</form>

Question 28.
Define File handling in PHP.
Answer:
File handling is an important part of any web application. We often need to open and process a file for different tasks.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 29.
Define Browse button in HTML.
Answer:

  1. The button isn’t called the browse button, that’s just the name our browser gives for it.
  2. In a form, the file value of the type attribute allows we to define an input element for file uploads. This displays a browse button, which the user can click on to select a file on their local computer.

Question 30.
Write Syntax of Browse button in HTML.
Answer:
Syntax:
<input type = “file” name = “myfile”>
<input type ‘= “file”>
defines a file – select field and a Browse button for file uploads.
To define a file – select field allows multiple files to be selected, and the ‘multiple’ attribute.

Question 31.
Compare Text box and Text Area.
Answer:

Text box

 Text area

Text boxes are most common in Forms.  Text area are larger versions of the text box.
Text boxes generally used for collecting information such names, email addresses, URLs, etc.  Text area are generally used to gather feedback or comments.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 32.
Usage of File open function.
Answer:

  1. The Fopen ( ) function in PHP is an inbuilt function which is used to open a file or an URL.
  2. It is used to bind a resource to a steam using a specific filename.

Question 33.
Write the features Form Handling.
Answer:

  1. Forms are used to get data from the users.
  2. Forms are created using HTML Tags.
  3. Forms can be submitted to the server for processing using either Post or GET method.
  4. Forms values submitted via the POST method are encapsulated in the HTTP body.
  5. Forms values submitted via the GET method are appended and displayed in the URL.

Question 34.
Write the purpose GET method and POST method.
Answer:
Purpose of GET method:

  1. The variable names and values will be visible in URL, if HTML forms submitted by the GET method.
  2. The GET method data can be accessed using PHP Query-string environment variable.
  3. PHP$_GET associative array is used to access all the sent information by GET method.

Purpose of POST method:

  1. The POST method does not have any restriction on data size to be sent.
  2. The POST method c,an be used’ to send ASCII as well as binary data.
  3. PHP $_POST associative array is used to access all the sent information by POST method.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 35.
Differentiate GET and POST Method.
Answer:

Basis comparison  GET method

 POST method

Purpose  URL  Body
Security  Vulnerable, as present in plain text  Safer than GET method.
Form data length  Should be kept as minimum as possible.  Could lie in any range.
Visibility  Can be seen by anyone.  Doesn’t display variable in URL.
Variable size  Upto 2000 characters.  Upto 8 Mb.

Question 36.
Write short notes on File handling.
Answer:
File handling starts with creating a file, reading its content, writing into a file to appending data into an existing file and finally closing the file.
PHP provides modes on file handling,
These are

TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files 3

File handling is an important activity of all web application development process.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 37.
Write short notes on File handling functions.
Answer:

  1. A file is a resource for storing data. PHP has a rich collection of built in functions that simplify working with files.
  2. fopen ( ) is a system function available in PHP. This function helps to open a file in the server. .
  3. fread ( ) function reads from an open file. The file object comes from fopen function. ,
  4. fclose( ) function is used to close an opened file. The file object comes . from fopen function.
  5. fwrite ( ) function is used to write to a file.

Question 38.
Explain Form Handling methods.
Answer:
(i) In PHP form Handling method, when the user keying the input data in HTML controls and clicks the submit button the request will be generated and reaches a PHP file which is mentioned in the FORM tag under the Action Attribute.
(ii) All input values are synchronized and sent to the server via POST method or GET method.
(iii) Method is an attribute form tag in HTML.
(iv) Once the data reaches the server, two PHP variable such as $_Post and $_GET collects the data and prepares the response accordingly.

POST method:
The input data sent to the server with POST method is stored in the request body of the clients HTTP request.

Syntax:
<? php
$POST [variable_name];
?>
Here,
$_Post {…] is the php array,
variable_name is the URL variable name.

GET method:
The input data sent to the server with POST method via URL address is known as query string. All input data are visible by user after they clicks the submit button.

Syntax:
<?php
$_GET [ ‘variable_name’];
?>
Here,
$_GET is the php array
Variable_name is the URL variable name.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 39.
Discuss in detail about HTML form controls.
Answer:
(i) An HTML form is a section of a document containing normal content, markup, special elements called controls.
(ii) Check boxes, radio buttons, menus etc., and labels are called Form controls.
(iii) A controls control Name is given” by its name attribute. The scope of the name attribute for a control within a FORM element is the FORM element.
(iv) Buttons may create three types that are submit buttons, Reset buttons and Push buttons.
(v) Several checkboxes in a form may control by the same control name. The INPUT element is used to create a checkbox control.
Radio buttons are like check boxes except that when several share the same… control name, they are mutually exclusive.
Menus offer users options from which to choose. The SELECT element creates a menu, in combination with the OPTGROUP and OPTION elements.
Text Input may creates two types, the INPUT element creates a single-line input control and the TEXTAREA element creates a multiline input control.

Question 40.
Explain the process File handling.
Answer:
File handling is an important activity of all web application development process.
Files are processed for different tasks using the following events.

(i) PHP open a File:
fopen( ) is a system function available in PHP. This function helps to open a file in the server. It contains two parameters one for the file and other one specifies in which mode the file should be opened (Read / write).
Syntax:
$file_object = fopen (“fil’ename”, “Read / Write mode”) or die (“Error message”);
Eg:
<?php
$myfile = fopen (“Student.txt”, “r”) or die
(“unable to open file”) ;
?>

(ii) PHP Read a file:
The fread( ) function reads from an open file. The file object comes from fopen function.
Syntax:
fread ($file_object, filesize (“Fileneme”));
Eg:
<?php
fread ($myfile, file size (“student.txt”));
?>

(iii) PHP close file:
The fclose ( ) function is used to close an opened file. The file object comes from fopen function.
Syntax:
fclose ($file_object);
Eg:
<?php
//Some code to be executed…
fclose ($myfile);
?>

(iv) PHP write a File:
The write ( ) function is used to write to a file.
Syntax:
fwrite (Smyfile, Stxt);
Eg:
<?PhP
//some code to be executed…
fwrite ($myfile, $txt) ;
?>

(v) PhP Appending a file:
The file_put_contents( ) function is used to append to a file.
Syntax:
file_put_co‘ntents (file, data, mode, context);
Eg:
<?php
$tx = “student_id”;
Smyfile = file_put_contents (“logs.txt”, $txt,
PHP_EoL, FILE_APPEND | LOCK_Ex);

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 41.
Explain concepts of HTTP Uploading process.
Answer:
(i) Concepts of HTTP uploading process is the best feature to select one file from the local machine to server machine.
(ii) Form tag is used to mention a method as POST or GET and encrypt attribute mentioned as “multipart / form- data”.
(iii) In the <Input>tag mention type = “file” attribute shows the input field as a file-select control, with a “Browse” button next to the input control.
(iv) In server machine “PhP.ini” file, search for the fileuploads directive, and set it to on: “file uploads – on”
(v) After submitting the upload button the request reaches to PhP file. .
(vi) In the file $_Files variable collects all uploaded file information such as name of the file, size of the file, and extension of the file etc.,
(vii) All the details are checker thoroughly and the errors are saved in an array variable.
(viii) The file finally moves under the image directory if the array error • variable is empty.
Eg:
<form action = “student_photo_upload.PhP
“method = “Post” enctype = “multipart / form-data”>
<input type + “file name” – file tc upload” id = “file to upioad”>
<input type = “submit” value = “upload image” name = “submit”>
</form>

Question 42.
Explain in detail of File handling functions.
Answer:
A file is a resource for storing data. PHP has a rich collection of built in functions that simplify working with files.
For refer Part IVquestion no.3 ((i) to (v) points)

Question 43.
Create simple student Login Form to validate username and password using java script (client side validation).
Answer:

TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files 4

HTML file: Javascript_login.html <html>
<head>
<title> Javascript Login Form Validation </title>
<link rel=”stylesheet” href= “css/style.css”/>
<script src = “js / login.js”> </script>
</head>
<body>
<div class= “container”>
<div class= “main”>
<h2> Javascript Login forirt validation </h2>
<form id= “form_id” method = “Post” name= “My form”>
<label>user Name: </label>
<input type=”text” name=”user name” id= “user name”/> <label> password: </labei>
<input type = “password” name = “password” id =”password”/>
<input type = “button”- value = “login” id = “submit” onclick = “validate ()”/>
</form>
<span> <b class = “note”>Note: c/b> c/div>
</div>
</body>
</html>

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 44.
Create simple student registration form to inert students details like Student Name, username and password etc. using java script (client side validation).
Answer:

TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files 5

Form creation using HTML code, then using on submit function Java Script.
<!DOCTYPE html>
<html>
<head>
<title> Java Script Form or registration form </title>
<link rel= ‘stylesheet’ href = ‘js-form-validation.css’ type = ||text /css’/>
<script src = “sample_registration.js”>
</script>
</head>
<body on load = “document.registration. userid.focus();”>
<h1> Registration Form </h1>
<UL>
<li> <label for “userid”>userid: </labelx/li>
<li> <input type= “userid”> size = “12”/></li>
<li> <label for = “passid”> password: </label> </li>
<li> <input type = “password” name = “passid” size = “12”/> </li>
<li> <label for = “username”> name:</labe1></li>
<li> <input type = “text”name = “username” size = “50”/> </li> .
<li> <label for =”email”> Email: </label> </li>
<li> <input type =”text” name= “email” size = “50”/> </li>
<li> <input type = “submit” name = “submit” value = “submit”/> </li>
</UL>
</form>
</body>
</html>

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Choose the correct answer:

Question 1.
The file size ( ) function returns the file size in:
(a) bits
(b) bytes
(c) kilobytes
(d) giga bytes
Answer:
(b) bytes

Question 2.
Which one of the following PHP function is used to determine a file’s last access time?
(a) fileltime( )
(b) filectime( )
(c) fileatime( )
(d) filetime( )
Answer:
(c) fileatime( )

Question 3.
Which one of the following function is capable of reading a file into an array?
(a) file( )
(b) arrfile( )
(c) arr_file( )
(d) file_arr( )
Answer:
(a) file( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 4.
Which one of the following function is capable of reading a file into a string variable?
(a) file_contents( )
(b) file_get_contents( )
(c) file_content( )
(d) file_get_content( )
Answer:
(b) file_get_contents( )

Question 5.
Which one of the following function is capable of reading a specific number of characters from a file?
(a) fgets( )
(b) fget ( )
(c) fileget( )
(d) filegets( )
Answer:
(a) fgets( )

Question 6.
Which one of the following function operates similarly to fgets()?
(a) fgetsh( )
(b) fgetsp()
(c) fgetsa( )
(d) fgetss( )
Answer:
(d) fgetss( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 7.
Which one of the following function outputs the contents of a string variable to the specified resource?
(a) filewrite( )
(b) fwrite( )
(c) filewrites( )
(d) fwrites( )
Answer:
(b) fwrite( )

Question 8.
Which function sets the file filename last-modified and last-accessed times?
(a) sets ( )
(b) set ( )
(c) touch ( )
(d) touched ( )
Answer:
(c) touch ( )

Question 9.
Which of the following are HTML form controls?
(a) text box
(b) drop down box
(c) radio button
(d) all of these
Answer:
(d) all of these

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 10.
Which control contain text inputs?
(a) text box
(b) text area
(c) both (a) and (b)
(d) drop down box
Answer:
(c) both (a) and (b)

Question 11.
Which selects more than one value from the HTML form?
(a) text box
(b) check box
(c) drop down box
(d) text area
Answer:
(b) check box

Question 12.
Radio box is similar to:
(a) check box
(b) text box
(c) drop down box
(d) text area
Answer:
(a) check box

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 13.
PHP file which is mentioned in the Form tag under the:
(a) Action Attribute
(b) POST
(c) GET
(d) FORM
Answer:
(a) Action Attribute

Question 14.
Which is attribute form tag in HTML?
(a) Attribute
(b) Method
(c) FORM
(d) Variable
Answer:
(b) Method

Question 15.
Which method is stored in the request body of the client’s HTTP request?
(a) Attribute
(b) FORM
(c) POST
(d) GET
Answer:
(c) POST

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 16.
Which method known as query string via URL address?
(a) Attribute
(b) FORM
(c) POST
(d) GET
Answer:
(d) GET

Question 17.
Which is a process of checking the input data submitted by the user from client machine?
(a) browser
(b) validation
(c) client
(d) server
Answer:
(b) validation

Question 18.
How many types of validation available in PHP?
(a) 2
(b) 3
(c) 4
(d) 5
Answer:
(a) 2

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 19.
Which type of validation is input data validation?
(a) Client-side
(b) Server-side
(c) Attribute
(d) Required
Answer:
(a) Client-side

Question 20.
Which one of attribute in HTML input tags using client side scripts?
(a) Action
(b) Required
(c) Server
(d) Client
Answer:
(b) Required

Question 21.
Which one of the following is client side scripts?
(a) PHP
(b) ASP
(c) JSP
(d) Java scripts
Answer:
(d) Java scripts

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 22.
Which one of the following is server side scripts?
(a) PHP
(b) Java scripts
(c) Web server
(d) Mail server
Answer:
(a) PHP

Question 23.
Choose one of the following it to a back end application.
(a) ASP
(b) Web server
(c) Mail server
(d) Web browser
Answer:
(a) ASP

Question 24.
Which is an important activity of all web application development process?
(a) Browsing
(b) Validations
(c) Activities
(d) File handling
Answer:
(d) File handling

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 25.
Which PHP function helps to open a file in the server?
(a) fread( )
(b) fopen( )
(c) fclose( )
(d) fappend( )
Answer:
(b) fopen( )

Question 26.
Which PHP function reads from an open file?
(a) fread( )
(b) fopen( )
(c) fclose( )
(d) fappend( )
Answer:
(a) fread( )

Question 27.
Which PHP function is used to Append to a file?
(a) fappend( )
(b) file_put_contents( )
(c) fread( )
(d) fopen( )
Answer:
(b) file_put_contents( )

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 28.
Which is the best feature to select one file from the local machine to server machine?
(a) fappend
(b) fread( )
(c) file upload
(d) append to a file
Answer:
(c) file upload

Question 29.
AJAX meAnswer:
(a) Asynchronous Javascript And XML
(b) ASP Javascript And XML
(c) Assembly Javascript And XML
(d) ASP JPEG And XML
Answer:
(a) Asynchronous Javascript And XML

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 30.
Which attribute action backend script ready to process your passed data?
(a) Required
(b) Action
(c) Form
(d) File
Answer:
(c) Form

Question 31.
Match the following:

(A) Text input  (i) check box
(B) Radio box  (ii) text box
(C) POST method  (iii) Submit button
(D) GET method  (iv) HTTP request

(a) (A) – (ii); (B) – (i); (C) – (iii); (D) – (iv)
(b) (A) – (ii); (B) – (i); (C) – (iv); (D) – (iii)
(c) (A) – (iv); (B) – (iii); (C) – (i); (D) – (ii)
(d) (A) – (iv);, (B) – (i); (C) – (ii); (D) – (iii)
Answer:
(b) (A) – (ii); (B) – (i); (C) – (iv); (D) – (iii)

Question 32.
Match the following:

(A) fopen( )  (i) write a file
(B) fread( )  (ii) close on opened file
(C) fclose( )  (iii) reads open a file
(D) fwrite( )  (iv) open a file

(a) (A) – (iv); (B) – (i); (C) – (ii); (D) – (iii)
(b) (A) – (iv); (B) – (iii); (C) – (i); (D) – (ii)
(c) (A) – (iv); (B) – (iii); (C) – (ii); (D) – (i)
(d) (A) – (iii); (B) – (ii); (C) – (i); (D) – (iv)
Answer:
(c) (A) – (iv); (B) – (iii); (C) – (ii); (D) – (i)

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 33.
Match the following:

(A) “x”  (i) opens a file write only
(B) “w”  (ii) file opened read only
(C) “r”  (iii) open file read and write
(D) “w”  (iv) new file created write only

(a) (A) – (iv); (B) – (i); (C) – (ii); (D) – (iii)
(b) (A) – (iv); (B) – (iii); (C) – (i); (D) – (ii)
(c) (A) – (iii); (B) – (iv); (C) – (ii); (D) – (i)
(d) (A) – (iii); (B) – (ii); (C) – (i); (D) – (iv)
Answer:
(a) (A) – (iv); (B) – (i); (C) – (ii); (D) – (iii)

Question 34.
Choose the incorrect pair.
(a) Reset – button
(b) Text area – text inputs
(c) Radio box – check box
(d) Post – file name
Answer:
(d) Post – file name

Question 35.
Choose the correct pair.
(a) Text input – email
(b) Website – URL
(c) CGL – OS
(d) PHP – data type
Answer:
(b) Website – URL

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 36.
Choose the incorrect statement:
(a) Radio box is similar to check box.
(b) File select is the best feature to select one file from the local machine.
(c) Check box is the important feature which select only one value from the HTML form.
(d) Form tag is used to mention a method POST or GET.
Answer:
(c) Check box is the important feature which select only one value from the HTML form.

Question 37.
Choose the incorrect statement:
(a) A Appending a file parameter required, specifies the file to write to.
(b) A data parameter required, the data read from the user.
(c) The parameter mode optional, specifies how to open / write to the file possible values
(d) Context is a set of options that can modify the behaviour of a stream.
Answer:
(b) A data parameter required, the data read from the user.

Question 38.
Choose the correct statement:
(a) HTML is a scientific programming language. .
(b) A PHP script can’t be used with HTML form.
(c) File handling is an important part of any web application.
(d) The input data validations are performed on the server side programming.
Answer:
(c) File handling is an important part of any web application.

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 39.
Assertion (A):
Validation is a process of checking the input data submitted by the user from client machine.
Reason (R):
There are two types of validation in PHP. They are client-side validation, and server side validation.
(a) Both A and R are true, and R is the correct explanation for A.
(b) Both A and R are true, but R is die not correct explanation for A.
(c) A is true, But R is false.
(d) A is false, But R is true.
Answer:
(a) Both A and R are true, and R is the correct explanation for A.

Question 40.
Pick the odd one out.
(a) PHP
(b) ASP
(c) POST
(d) JSP
Answer:
(c) POST

Question 41.
When you use the $_GET variable to collect data, the data is visible to:
(a) none
(b) only you
(c) everyone
(d) selected few
Answer:
(c) everyone

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 42.
Which one of the following should not be used while sending passwords or other sensitive information?
(a) GET
(b) POST
(c) REQUEST
(d) NEXT
Answer:
(a) GET

Question 43.
Which directive determines whether PHP scripts on the server can accept file uploads?
(a) file_uploads
(b) file_upload
(c) file_input
(d) file_intake
Answer:
(a) file_uploads

Question 44.
In HTML form <input type=”text”> is used for:
(a) One line text
(b) Block of text
(c) One paragraph
(d) None
Answer:
(a) One line text

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 45.
HTML classes that is already defined and allow us to apply styles on it are . called as:
(a) Pseudo classes
(b) Css classes
(c) Javascript classes
(d) None
Answer:
(b) Css classes

Question 46.
If you would like to read a file character by character which function do you use?
(a) fopen ( )
(b) fread ( )
(c) fgetc ( )
(d) file ( )
Answer:
(c) fgetc ( )

Question 47.
PHP is a typed language.
(a) User
(b) Loosely
(c) Server
(d) System
Answer:
(c) Server

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 48.
What does fopen( ) function do in PHP?
(a) It used to open files in PHP
(b) It used to open Remote Server
(c) It used to open folders in PHP
(d) It used to open Remote Computer
Answer:
(a) It used to open files in PHP

Question 49.
How PHP files can be accessed?
(a) Through Web Browser
(b) Through HTML files
(c) Through Web Server
(d) All of Above
Answer:
(d) All of Above

Samacheer Kalvi TN State Board 12th Computer Applications Important Questions Chapter 8 Forms and Files

Question 50.
Which of the following functions reads the entire contents of a file?
(a) fgets( )
(b) file_get_contents( )
(c) fread( )
(d) readfile( )
Answer:
(b) file_get_contents( )

TN Board 12th Computer Applications Important Questions