PHP || College Papers solutions

4th semester

ASain 2073

1. What are the different ways of writing comments in PHP

  • →// and /* are the different ways of writing comments in PHP

2. Write the function to convert given array to string. Give examples

  • → mysql_fetch_array() is the function to convert given array to string

3. How do you connect to database server? Write example

  •  <?php $con=mysql_connect(“localhost”,”root”,””);or die(“Cannot Connect to server”);’  ?>

4. What are the difference between include() and require() function

  •  The require() Function. The require() function takes all the text in a specified file and copies it into the file that uses the include function. If there is any problem in loading a file then the require() function generates a fatal error and halt the execution of the script.

5.What is the use of intval() function

  •  One thing to note about the difference between (int) and intval() : intval() treats variables which are already int s and float s as needing no conversion, regardless of the base argument (as of PHP 5.3.5 at least). … The common rules of integer casting apply

6. How to display the current date in web page

  • The current date can be display using date function in web page using PHP statement

7.What is the use of foef() function

  •  The feof() function checks if the “end-of-file” (EOF) has been reached.

8. Write two difference between HTTP GET and 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.

9. Write the advantage of writing function in program

  • A function in a program is important because of following reasons:
  1. Code reusability
  2. Manageability
  3. Reduced redundancy in programming
  4. Logical clarity
  5. Easy to divide the task among programmer

10.What is web server? Give example

  • → A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers’ HTTP clients. Dedicated computers and appliances may be referred to as Web servers as well





NCCS 2016 [SET A]

1. What is web server

  •  A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers’ HTTP clients. Dedicated computers and appliances may be referred to as Web servers as well

2. What is client side validation

  • Validations can be performed on the server side or on the client side ( web browser). The user input validation take place on the Server Side during a post back session is called Server Side Validation and the user input validation take place on the Client Side (web browser) is called Client Side Validation.

3. Write rules for creating function in php

  •  Any valid PHP code may appear inside a function, even other functions and class definitions. Function names follow the same rules as other labels in PHP. A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.

4.Give a condition when variable declared will be a local scope

  • → When we need the variable within then function then we will declared a local scope

5. What is the use of strpos() function
→ The strpos() function finds the position of the first occurrence of a string inside another string. … stripos() – Finds the position of the first occurrence of a string inside another string (case-insensitive)
6. What do you understand by file permission
→ Most file systems have methods to assign permissions or access rights to specific users and groups of users. These systems control the ability of the users to view, change, navigate, and execute the contents of the file system.
7. What does mysqli_fetch_array() does
→ Fetch a result row as an associative array, a numeric array, or both.






 

NCCS 2016 [SET B]

1. What is web server ?
→ A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers’ HTTP clients. Dedicated computers and appliances may be referred to as Web servers as well
2.Differentiate between require() and require_one() ?
→ require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page). So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example.
3.What is server side validation ?
→ Validations can be performed on the server side or on the client side ( web browser). The user input validation take place on the Server Side during a post back session is called Server Side Validation and the user input validation take place on the Client Side (web browser) is called Client Side Validation.
4. How can we display time in php ?
→ the current time can be display using date function in web page using PHP statement
5.Give a condition when a variable has a Global scope.
→ If we need the same variables within whole program then a variable has a Global scope
6. Where will be the file pointer placed in w and w+ mode?
→ Both of them will create the file if it doesn’t exist. Then it will clear it out if it has information in it. … Then it will clear it out if it has information in it. w works for writing, w+ will work for reading a… … ‘w’ Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length
7 .What is the use of file_get_contain()?
→ The file_get_contents() reads a file into a string
8.What is header()?
→ Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called.
9.What does mysqli_field_count() does?
→ mysqli_field_count() return column of table.
 






Orchid 2073 [SET A]

1.What are the different ways of writing comments in PHP

  • // and /* are the different ways of writing comments in PHP

2. Write the function to convert given array to string. Give examples.

  •  mysqli_fetch_array() convert given array to string

3.What is dynamic web page? How it is differ to static page?

  •  The web page which can be modify without reaching source code is called dynamic web page. But in static web page we have to reach to source code for that

4. What are the differences between require() and require_one() function ?

  •  require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page). So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example.

5. What is the use of intval() function ?

  • One thing to note about the difference between (int) and intval() : intval() treats variables which are already int s and float s as needing no conversion, regardless of the base argument (as of PHP 5.3.5 at least). … The common rules of integer casting apply

6. How to display the current date in web page ?

  • The current date can be display using date function in web page using PHP statement

7. What is the use of feof() function

  • The feof() function checks if the “end-of-file” (EOF) has been reached.

8. Write two differences between HTTP GET and 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.

9. Write the advantages of writing function in program
→ A function in a program is important because of following reasons:

  1. Code reusability
  2. Manageability
  3. Reduced redundancy in programming
  4. Logical clarity
  5. Easy to divide the task among programmer

10. What is web server? Give example
→ A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers’ HTTP clients. Dedicated computers and appliances may be referred to as Web servers as well

Orchid 2073 [SET B]

1.Why comments are important in program?
→ Comment are important in program in order to increase reliability
2.Write the function to convert given string to array. Give examples.
→ mysqli_fetch_array() help to convert given string to array
3.What is required technology to make web page dynamic?
→ Database and JQuarries are required technology to make web page dynamic
4. What is the use of include_once() function ?
→ he problem is that is_int() thinks a string of numbers is a string, not an integer. … Note: This function require a string to be useful, so for example passing in an integer will always return FALSE
5 .What is_numeric() function does
→ The problem is that is_int() thinks a string of numbers is a string, not an integer. … Note: This function require a string to be useful, so for example passing in an integer will always return FALSE
6. How to take user define date from user in php
→ the user define date from user can be display using date function in web page using PHP statement
7 .What is the use of fwrite() function? Give example
→ The use of fwrite() function is to write in file
8. Write the advantage of array in a program
→ the advantage of array in a program is to reduce complexity and number of variables
9 .What is web client? Give example
→ The client, or user, side of the Web. It typically refers to the Web browser in the user’s machine. It may also refer to plug-ins and helper applications that enhance the browser to support special services from the site.

Leave a Reply

Your email address will not be published.