PHP - Multiple Choice Questions (MCQs) - Objective Questions

Set - 1  This set contains 20 objective questions with 4 options each. The correct answer is provided at the end of the page. 1. ...

Set - 1

 This set contains 20 objective questions with 4 options each. The correct answer is provided at the end of the page.

1.      A script is a
a.       Program or sequence of instructions that is interpreted or carried out by processor directly
b.      Program or sequence of instruction that is interpreted or carried out by another program
c.       Program or sequence of instruction that is interpreted or carried out by web server only
d.      None of above

Collection on http://www.cs-mcqs.blogspot.com


3.      When compared to the compiled program, scripts run
a.       Faster
b.      Slower
c.       The execution speed is similar
d.      All of above

Collection on http://www.cs-mcqs.blogspot.com


4.      PHP is a widely used ……………. scripting language that is especially suited for web development and can be embedded into html
a.       Open source general purpose
b.      Proprietary general purpose
c.       Open source special purpose
d.      Proprietary special purpose

Collection on http://www.cs-mcqs.blogspot.com


5.      Which of the following is not true?
a.       PHP can be used to develop web applications.
b.      PHP makes a website dynamic.
c.       PHP applications can not be compiled.
d.      PHP can not be embedded into html.

6.      The most portable version of PHP tag that is compatible to embed in XML or XHTML too is:
a.       <? ?>
b.      <script language=”php”> </script>
c.       <% %>
d.      

Collection on http://www.cs-mcqs.blogspot.com


7.      Which of the following variables is not a predefined variable?
a.       $get
b.      $ask
c.       $request
d.      $post

Collection on http://www.cs-mcqs.blogspot.com


8.      You can define a constant by using the define() function. Once a constant is defined
a.       It can never be changed or undefined
b.      It can never be changed but can be undefined
c.       It can be changed but can not be undefined
d.      It can be changed and can be undefined

Collection on http://www.cs-mcqs.blogspot.com


9.      The following piece of script will output:
<?
$email=’admin@psexam.com’;
$new=strstr($email, ‘@&rsquoWink;
print $new;
?>
a.       admin
b.      admin@psexam
c.       @psexam.com
d.      psexam.com

Collection on http://www.cs-mcqs.blogspot.com


10. Which of the following function returns the number of characters in a string variable?
a.       count($variable)
b.      len($variable)
c.       strcount($variable)
d.      strlen($variable)

Collection on http://www.cs-mcqs.blogspot.com


11. When you need to obtain the ASCII value of a character which of the following function you apply in PHP?
a.       chr( );
b.      asc( );
c.       ord( );
d.      val( );

Collection on http://www.cs-mcqs.blogspot.com


12. A variable $word is set to “HELLO WORLD”, which of the following script returns in title case?
a.       echo ucwords($word)
b.      echo ucwords(strtolower($word)
c.       echo ucfirst($word)
d.      echo ucfirst(strtolower($word)

Collection on http://www.cs-mcqs.blogspot.com


13. The difference between include() and require()
a.       are different how they handle failure
b.      both are same in every aspects
c.       is include() produced a Fatal Error while require results in a Warning
d.      none of above

Collection on http://www.cs-mcqs.blogspot.com


14. When a file is included the code it contains, behave for variable scope of the line on which the include occurs
a.       Any variable available at that line in the calling file will be available within the called file from that point
b.      Any variable available at that line in the calling file will not be available within the called file
c.       Variables are local in both called and calling files
d.      None of above

Collection on http://www.cs-mcqs.blogspot.com


15. Which of the following method sends input to a script via a URL?
a.       Get
b.      Post
c.       Both
d.      None

Collection on http://www.cs-mcqs.blogspot.com


16. Which of the following method is suitable when you need to send larger form submissions?
a.       Get
b.      Post
c.       Both Get and Post
d.      There is no direct way for larger form. You need to store them in a file and retrieve

Collection on http://www.cs-mcqs.blogspot.com


17. Which of the following mode of fopen() function opens a file only for writing. If a file with that name does not exist, attempts to create anew file. If the file exist, place the file pointer at the end of the file after all other data.
a.       W
b.      W+
c.       A
d.      A+

Collection on http://www.cs-mcqs.blogspot.com


18. The function setcookie( ) is used to
a.       Enable or disable cookie support
b.      Declare cookie variables
c.       Store data in cookie variable
d.      All of above

Collection on http://www.cs-mcqs.blogspot.com


19. To work with remote files in PHP you need to enable
a.       allow_url_fopen
b.      allow_remote_files
c.       both of above
d.      none of above

Collection on http://www.cs-mcqs.blogspot.com


20. fopen($file_doc,”r+&rdquoWink opens a file for
a.       reading
b.      writing
c.       none of above
d.      both of above

Collection on http://www.cs-mcqs.blogspot.com




Answers:



1.      A script is a
b.      Program or sequence of instruction that is interpreted or carried out by another program

3.      When compared to the compiled program, scripts run
b.      Slower 

4.      PHP is a widely used ……………. scripting language that is especially suited for web development and can be embedded into html
a.       Open source general purpose 

5.      Which of the following is not true?
d.      PHP can not be embedded into html. 

6.      The most portable version of PHP tag that is compatible to embed in XML or XHTML too is:
d.       

7.      Which of the following variables is not a predefined variable?
b.      $ask 

8.      You can define a constant by using the define() function. Once a constant is defined
a.       It can never be changed or undefined

9.      The following piece of script will output:
<?
$email=’admin@psexam.com’;
$new=strstr($email, ‘@&rsquoWink;
print $new;
?>
c.       @psexam.com

10. Which of the following function returns the number of characters in a string variable?
d.      strlen($variable) 

11. When you need to obtain the ASCII value of a character which of the following function you apply in PHP?
c.       ord( );

12. A variable $word is set to “HELLO WORLD”, which of the following script returns in title case?
b.      echo ucwords(strtolower($word)

13. The difference between include() and require()
a.       are different how they handle failure 

14. When a file is included the code it contains, behave for variable scope of the line on which the include occurs
a.       Any variable available at that line in the calling file will be available within the called file from that point 

15. Which of the following method sends input to a script via a URL?
a.       Get 

16. Which of the following method is suitable when you need to send larger form submissions?
b.      Post 

17. Which of the following mode of fopen() function opens a file only for writing. If a file with that name does not exist, attempts to create anew file. If the file exist, place the file pointer at the end of the file after all other data.
c.      

18. The function setcookie( ) is used to
c.       Store data in cookie variable

19. To work with remote files in PHP you need to enable
a.       allow_url_fopen

20. fopen($file_doc,”r+&rdquo Wink opens a file for
d.      both of above


Set - 2

 This set contains 20 objective questions with 4 options each. The correct answer is provided at the end of the page.

1. In mail($param2, $param2, $param3, $param4), the $param2 contains:
a.       The message
b.      The recipient
c.       The header
d.      The subject


2. mysql_connect( ) does not take following parameter
a.       database host
b.      user ID
c.       password
d.      database name


3. Study following steps and determine the correct order
(1)   Open a connection to MySql server
(2)   Execute the SQL query
(3)   Fetch the data from query
(4)   Select database
(5)   Close Connection
a. 1, 4, 2, 3, 5
b. 4, 1, 2, 3, 5
c. 1, 5, 4, 2, 1
d. 4, 1, 3, 2, 5


4. Which of the following is not a session function?
a.       sssion_decode
b.      session_destroy
c.       session_id
d.      session_pw


5. When uploading a file if the UPLOAD_ERR-OK contains value 0 it means
a.       Uplaod is not successful, error occurred
b.      The file uploaded with success
c.       Uploaded file size is 0
d.      File upload progress is 0% completed 
 

6.      Which of the following delimiter syntax is PHP's default delimiter syntax
a.      <? php ?>
b.      <%   %>
c.       <?     ?>
d.      <script language="php"> </script>


7.      Which of the following statement produce different output
a.      <?echo "This is php example"; ?>
b.      <P="This is php example"; ?>
c.       <?PHP echo "This is php example"; php?>
d.      <script language="php"> print "This is php example";</script>


8.      Which of the following delimiter is ASP style?
a.     
b.      <% %>
c.       <? ?>
d.      <script language="php"> </script>


9.      Php supports all four different ways of delimiting. In this context identify the false statement
a.      You can use any of the delimiting style
b.      You can use different delimiting styles in same page
c.       You can use any delimiting style but must use a single style consistently for a page
d.      Variables declared in previous blocks are remenbered on later blocks too!


10.      Which of following commenting is supported by Php
a.      Single line c++ syntax - //
b.      Shell syntax - #
c.       Both of above
d.       None of above


11.      To produce the output6 I love the summer time, Which of the ofllowing statement should be used?
a.      <? Php print ("<P> I love the summer time</p>"Wink;?>
b.      <? Php $ season="summer time"; print"<p> I love the $ season</p>"; ?>
c.       <?Php $ message="<p> I love the summer time </p>; ecdho $ message; ?>
d.      All of above


12.      Which of following function return 1 when output is successful?
a.      echo ( )
b.      print ( )
c.       both
d.      None


13.      Which of followng statement is more suitable if you want to output a blend of static text and dynamic information stored within one or several variables?
a.      echo ( )
b.      print ( )
c.       Print f ( )
d.      None of above


14.      Which of the following type specifier is invalid in print f ( ) functions
a.      % a
b.      % b
c.       % c
d.      % d


15. Which of the following function can assign the output to a string variable
a.      echo ( )
b.      print ( )
c.       print f ( )
d.      s print f ( )


16. Which of the following data type is not seal or datetype supported by PHP
a.      Array
b.      String
c.       Float
d.      Boolean


17. Which of the following data type is compound datatype supported by PHP
a.      Array
b.      String
c.       Float
d.      Boolean


18. If a boolean variable $ alive= 5;
a.      $ alive is false
b.      $ alive is true
c.       $ alive is overflow
d.      the statement is snot valid


19. For integer data type PHP 6 introduced
a.      8 bit integer value
b.      16 bit integer value
c.       32 bit integer value
d.      64 bit integer value


20. For integer data type PHP 5 and earlier supported
a.      8 bit integer value
b.      16 bit integer value
c.       32 bit integer value
d.      64 bit integer value





Answers:



1. In mail($param2, $param2, $param3, $param4), the $param2 contains:
d.      The subject


2. mysql_connect( ) does not take following parameter
d.      database name


3. Study following steps and determine the correct order
(1)   Open a connection to MySql server
(2)   Execute the SQL query
(3)   Fetch the data from query
(4)   Select database
(5)   Close Connection
a. 1, 4, 2, 3, 5


4. Which of the following is not a session function?
d.      session_pw


5. When uploading a file if the UPLOAD_ERR-OK contains value 0 it means
b.      The file uploaded with success 

6.      Which of the following delimiter syntax is PHP's default delimiter syntax
a.     

7.      Which of the following statement is invalid?
c.       <?PHP echo "This is php example"; php?>

8.      Which of the following delimiter is ASP style?
b.      <% %>

9.      Php supports all four different ways of delimiting. In this context identify the false statement
c.       You can use any delimiting style but must use a single style consistently  for a page

10.      Which of following commenting is supported by Php
c.       Both of above

11.      To produce the output "I love the summer time", Which of the ofllowing statement should be used?
d.      All of above

12.      Which of following function return 1 when output is successful?
b.      print ( )

13.      Which of followng statement is more suitable if you want to output a blend of static text and dynamic information stored within one or several variables?
c.       Printf ( )

14.      Which of the following type specifier is invalid in print f ( ) functions
a.      % a

15. Which of the following function can assign the output to a string variable
d.      sprintf ( )

16. Which of the following data type is not seal or datetype supported by PHP
a.      Array

17. Which of the following data type is compound datatype supported by PHP
a.      Array

18. If a boolean variable $ alive= 5;
b.      $ alive is true

19. For integer data type PHP 6 introduced
d.      64 bit integer value

20. For integer data type PHP 5 and earlier supported
c.       32 bit integer value

Set - 3

 This set contains 20 objective questions with 4 options each. The correct answer is provided at the end of the page.


1.  Trace the odd data type
a.  floats
b.  integer
c.  doubles
d.  Real number
2.  Which of the folowing are valid float values?
a.  4.5678
b.  4.0
c.  7e4
d.  All of above
3.  In php string data are
a.  delimited by single quote
b.  delimited by double quote
c.  delimited by <<< identifier
d.  All of above
4.  Which of the following delimiting method is known as string Interpolation
a.  delimited by single quote
b.  delimited by double quote
c.  delimited by <<< identifier
d.  All of above
5.  Which datatypes are treaded as arrays
a.  Integer
b.  Float
c.  String
d.  Booleans
6.  Which of following are compound data type?
a.  Array
b.  Objects
c.  Both
d.  None
7.  Casting operator introduced in PHP 6 is
a.  (array)
b.  (int64)
c.  (real) or (double) or (float)
d.  (object)
8.  When defining identifier in PHP you should remember that
a.  Identifier are case sensitive. So $result is different than $ result
b.  Identifiers can be any length
c.  Both of above
d.  None of above
9.  Identify the invalid identifier
a.  my-function
b.  size
c.  –some word
d.  This&that
10. Which of folowiing variable assignment is 'by value' assignment in PHP
a.  $value1= $value?
b.  $value1= & $value?
c.  $value1= & $value?
d.  None
11. Identify the variable scope that is not supported by PHP
a.  Local variables
b.  Function parameters
c.  Hidden variables
d.  Global variables
12. The output of ofllowing script would be
$somerar=15;
function ad it () {
GLOBAL $somevar;
$somerar++ ;
echo "somerar is $somerar";
}
addit ();
a.  somerar is 15
b.  somerar is 16
c.  somerar is 1
d.  somerar is $ somerar
13. Variable scope on which a variable does not loose its value when the function exists and use that value if the function is called again is:
a.  Local
b.  function parameter
c.  static
d.  None of above
14. The left association operator % is used in PHP for
a.  percentage
b.  bitwise or
c.  division
d.  modulus
15. The left associative dot operator (.) is used in PHP for
a.  multiplication
b.  concatenation
c.  separate object and its member
d.  delimeter
16. Trace the false statement
a.  Any code found within an included file will inherit the variable scope of the location of its caller
b.  Because the included code will be embedded in a PHP execution block, the PHP execution block, the PHP escape tags (<?php?>Wink aren't required on the file to be included
c.  For the inclusion of remote files the allow-url-pope must be enabled ad URL wrapper must be supported
d.  Including a file produces the same result as copying the data from the file specified into the location in which the statement appears.
17. Which of the following functions require the allow-url-fopen must be enabled?
a.  include()
b.  require()
c.  both of above
d.  None of above
18. Which function includes the specified file even the statement evaluates to false in which block the function is placed.
a.  include ()
b.  require ()
c.  both of above
d.  None of above
19. On failure of which statement the script execution stops displaying error/warning message?
a.  rinclude ()
b.  require ()
c.  both of above
d.  None of above
20. Trace the function that does continue the script execution even if the file inclusion fails
a.  include ()
b.  require ()
c.  both of above
d.  None of above



Answers:



1.  Trace the odd data type
b.  integer
2.  Which of the folowing are valid float values?
d.  All of above
3.  In php string data are
d.  All of above
4.  Which of the following delimiting method is known as string Interpolation
c.  delimited by <<< identifier
5.  Which datatypes are treaded as arrays
c.  String
6.  Which of following are compound data type?
c.  Both
7.  Casting operator introduced in PHP 6 is
b.  (int64)
8.  When defining identifier in PHP you should remember that
c.  Both of above
9.  Identify the invalid identifier
d.  This&that
10. Which of folowiing variable assignment is 'by value' assignment in PHP
a.  $value1= $value2
11. Identify the variable scope that is not supported by PHP
c.  Hidden variables
12. The output of ofllowing script would be
$somerar=15;
function ad it () {
GLOBAL $somevar;
$somerar++ ;
echo "somerar is $somerar";
}
addit ();
b.  somerar is 16
13. Variable scope on which a variable does not loose its value when the function exists and use that value if the function is called again is:
c.  static
14. The left association operator % is used in PHP for
d.  modulus
15. The left associative dot operator (.) is used in PHP for
b.  concatenation
16. Trace the false statement
b.  Because the included code will be embedded in a PHP execution block, the PHP execution block, the PHP escape tags (<?php?>Wink aren't required on the file to be included
17. Which of the following functions require the allow-url-fopen must be enabled?
c.  both of above
18. Which function includes the specified file even the statement evaluates to false in which block the function is placed.
b.  require ()
19. On failure of which statement the script execution stops displaying error/warning message?
b.  require ()
20. Trace the function that does continue the script execution even if the file inclusion fails
a.  include ()
 -------------

COMMENTS

BLOGGER: 3
  1. I like the valuable information you provide in your articles. I will bookmark your weblog and take a look at once more here regularly. I am reasonably certain I’ll be told plenty of new stuff right here! Best of luck for the next! apple reperatur berlin

    ReplyDelete
  2. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. choice carts

    ReplyDelete

TECH$type=three$author=hide

Name

5G Technology,1,Abbreviations,2,Agent AI,1,Agentic Ai,1,AI in Education,1,AI in Healthcare,1,AI in surgery,1,AI Reasoning,1,Algorithm,1,Algorithms,4,android,2,Artemis Mission,1,Artificial Intelligence,5,Artificial Intelligence AI,2,Artificial Neural Networks,1,ASCI and UNI),1,Augmented Reality,1,Automata,3,Blockchain,1,Blockchain Technology,1,C Language,2,C Programming,1,c#,1,C++,2,C++ Programming,1,CakePhp,1,Carbon Neutrality,1,CCNA,1,Cellular Communication,1,Chatgpt,1,Cloud Computing,4,Compiler Construction,1,Compiler Construction Solved MCQs,1,Compiler Design,1,Computer,18,Computer Applications,1,Computer Architecture,3,Computer Arithmetics,1,Computer Basics,1,Computer Codes (BCD,1,Computer Fundamentals,5,Computer Graphics,4,Computer Networking,2,Computer Networks,4,Computer Organization,1,Computer Science,2,Computer Short Cut Keys,1,Computer Short Keys,1,CPU Sceduling,1,Cryptocurrency,1,CSS,1,CSS PMS,1,Current Trends and Technologies,1,Custom Hardware,1,Cyber Security,6,Cybercrimes,1,DALL-E,1,Data Communication,1,Data Privacy,1,Data structures,3,Database Management System,4,DBMS,4,Deadlock,1,DeepSeek,1,Digital Systems,1,Digital Systems Solved MCQs - Part 2,1,Discrete Mathematics,2,Discrete Structure,1,dot Net,1,EBCDIC,1,Edge Computing,2,English,1,Ethical AI and Bias,1,Ethics,1,Explainable AI (XAI),1,File System,1,Flowcharts,1,General Data Protection Regulation GDPR,1,General Knowledge,1,Generative AI,2,Gig Economy,1,Graphics Designing,1,Helping Materials,1,HTML,1,HTML 5,1,hybrid work model,1,Inference Optimization,1,Information Systems,1,Information Technology,1,Inpage,1,intelligence,1,Internet,1,Internet Basics,1,Internet of Things,1,Internet of things IOT,2,IT,1,JavaScript,1,jQuery,1,Language,11,Languages Processor,1,Languge,1,Li-Fi,1,Linux/Unix,2,Magento,1,Memory Management,1,Microprocessor,1,Microsoft PowerPoint,1,MidJourney,1,mindfulness apps,1,MS Access,1,MS DOS,1,MS Excel,1,MS Word,2,Multimodal AI,1,NASA,1,Number System,1,Object Oriented Programming (OOP),1,Object Oriented Programming(OOP),1,Operating System,9,Operating System Basics,1,oracle,2,Others,1,Pakistan,1,PCS,1,PHP,1,PMS,1,Process Management,2,Programming,3,Programming Languages,1,Python,2,python language,1,Quantitative Aptitude,2,Quantum Computing,2,R Programming,1,Ransomware,1,Robotic Process Automation RPA,1,Robotics,2,Ruby Language,1,search engine optimization,1,Semester III,2,seo,1,Sloved MCQs on Microsoft Power Point - updated,1,Software Engineering,3,Solved MCQs of MS Access - Updated,1,Solved MCQs on Computer Fundamentals,1,SpaceX Starship,1,SQL,1,System Analysis and Design,1,Theory of Computation,1,Trends and Technologies,1,Virtual Reality,1,web,1,web Fundamental,1,Web Technologies,2,Web3,1,WEB3 Technology,1,x8086,1,zoology,1,
ltr
item
COMPUTER SCIENCE SOLVED MCQS: PHP - Multiple Choice Questions (MCQs) - Objective Questions
PHP - Multiple Choice Questions (MCQs) - Objective Questions
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwQNOV9gXGhDKeuH-S6UT7q8l42s-9kZbicBQjEU8UtFs2PcMPjeoUgO6u8wtvaGsLrBMe5SyucKSbNMacyeKRjgm9SgQJhJ6t9EQOlnyQ_Dyy9I9VfNwgBlHTmk0I7UAIBw1h-KL3nS4/s200/php.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwQNOV9gXGhDKeuH-S6UT7q8l42s-9kZbicBQjEU8UtFs2PcMPjeoUgO6u8wtvaGsLrBMe5SyucKSbNMacyeKRjgm9SgQJhJ6t9EQOlnyQ_Dyy9I9VfNwgBlHTmk0I7UAIBw1h-KL3nS4/s72-c/php.png
COMPUTER SCIENCE SOLVED MCQS
https://cs-mcqs.blogspot.com/2012/06/php-multiple-choice-questions-mcqs.html
https://cs-mcqs.blogspot.com/
https://cs-mcqs.blogspot.com/
https://cs-mcqs.blogspot.com/2012/06/php-multiple-choice-questions-mcqs.html
true
1616963833964386058
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content