0% found this document useful (0 votes)
28 views31 pages

BCA601QB

This document contains a question bank for the PHP exam with questions about PHP concepts and functions. It includes 50 questions covering topics like what PHP stands for, where PHP scripts are executed, basic PHP syntax like variables and loops, functions for manipulating strings and working with databases.

Uploaded by

email.9339249077
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)
28 views31 pages

BCA601QB

This document contains a question bank for the PHP exam with questions about PHP concepts and functions. It includes 50 questions covering topics like what PHP stands for, where PHP scripts are executed, basic PHP syntax like variables and loops, functions for manipulating strings and working with databases.

Uploaded by

email.9339249077
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/ 31

Semester 6

PHP(BCA 601)
External Examination JULY 2020
QUESTION BANK

Q.1) PHP Stands for


A. Php Hypertext Processor
B. Php Hypertext Preprocessor
C. Php Hypermarkup Preprocessor
D. Php Hypermarkup Processor
Ans : b

Q.2) PHP is _______ scripting language.


A. Server-side
B. Clint-side
C. Middle-side
D. Out-side
Ans : a

Q.3) PHP scripts are executed on _________


A. ISP Computer
B. Client Computer
C. Server Computer
D. It depends on PHP scripts
Ans : c
Q.4) PHP Scripts starts with ________
A. <php> … </php>
B. <?php …. ?>
C. ?php … ?php
D. <p> … </p>
Ans : B
Q.5) Which of the following statements prints in PHP?
A. Out
B. Write
C. Echo
D. Display
Ans : C

Q.6) In PHP, each statement must be end with ______


A. . (dot)
B. ; (semicolon)
C. / (slash)
D. : (colon)
Ans: B

Q.7) In PHP Language variables name starts with _____


A. ! (Exclamation)
B. & (Ampersand)
C. * (Asterisk)
D. $ (Dollar)
Ans : D

Q.8) In PHP Language variables are case sensitive


A. True
B. False
C. Depends on website
D. Depends on server
Ans: A

Q.9) In PHP a variable needs to be declare before assign


A. True
B. False
C. Depends on website
D. Depends on server
Ans:B

Q.10) Which of the following is not the scope of Variable in PHP?


A. Local
B. Global
C. Static
D. Extern
Ans : D

Q.11) What is the use of strlen( ) function in PHP?


A. It returns the type of a string
B. It returns the value of a string
C. It returns the length of a string
D. It returns the subset value of a string
Ans : C

Q.12) Which of the following is the Concatenation Operator in PHP?


A. + (Plus)
B. . (dot)
C. & (Ampersand)
D. % (Percentage)
Ans : B

Q.13) . Which of the following is not PHP Loops?


A. while
B. do while
C. for
D. do for
Ans : D

Q.14) What is the use of strpos( ) function in PHP?


A. Search for a number within a string
B. Search for a Spaces within a string
C. Search for a character/text within a string
D. Search for a Capitalized string/text with in a string
Ans : C

Q.15) Where setcookie( ) function must appear in PHP?


A. Before tag
B. After tag
C. In tag
D. Anywhere
Ans : A
Q.16) What does the hash (#) sign mean in PHP?
A. It indicates lines that are commented out.
B. It indicates variable declaration.
C. It indicates function declaration.
D. No uses in PHP.
Ans : A

Q.17) . How to define a variable in PHP?


A. $variable_name = value
B. $variable_name = value;
C. $variable_name == value;
D. $variable_name as value;
Ans : B

Q.18) The uses of strcmp( ) function in PHP?


A. It compare strings including case
B. It compare strings excluding case
C. It compare strings only Uppercase
D. It compare strings only lowercase
Ans: A

Q.19) What will be the result of combining a string with another data type in
PHP?
A. int
B. float
C. string
D. double
Ans: C

Q.20) Data for a cookie stored in _________ in PHP?


A. In ISP Computer
B. In User‟s Computer
C. In Server Computer
D. It depends on PHP Coding
Ans: B

Q.21) PHP is a ______ typed language.


A. User
B. Loosely
C. Server
D. System
Ans : B

Q.22) 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
Ans : A

Q.23) Where session_start() function must appear in PHP?


A. Anywhere
B. With <html> tag
C. After <html>tag
D. Before <html> tag
Ans : D

Q.24) What does the PHP Interpreter do?


A. It translates User Language to System Language
B. It creates connection between ISP & Server
C. It processes the HTML and PHP files
D. All of these
Ans : C

Q.25) Which of the following is used to add comments in PHP?


A. //
B. /* … */
C. & … &
D. Only A & B
Ans : D

Q.26) What does sprintf() function do in PHP?


A. it sends output to a variable
B. it prints the output of program
C. it sends output to a variable converting into string
D. it prints the output of program converting into string
Ans : A
Q.27) Which function displays the information about PHP?
A. info()
B. sysinfo()
C. phpinfo()
D. php_info()
Ans : C

Q.28) What does isset() function do in PHP?


A. There is no such function in PHP
B. It checks whether variable is set or not
C. It checks whether variable is free or not
D. It checks whether variable is string or integer
Ans : B

Q.29) How PHP files can be accessed?


A. Through Web Browser
B. Through HTML files
C. Through Web Server
D. All of Above
Ans : C

Q.30) Which one of the following property scopes is not supported by PHP?
a) friendly
b) final
c) public
d) static
Ans : A

Q.31) Which one of the following is the right way to call a class constant, given
that the class is mathFunction?
A) echo PI;
B) echo mathFunction->PI;
C) echo mathFunction::PI;
D) echo mathFunction=PI;
Ans : C
Q.32) Which of the following statements invoke the exception class?
a) throws new Exception();
b) throw new Exception();
c) new Exception();
d) new throws Exception();
Ans : B

Q.33) How to define a function in PHP?


a) function {function body}
b) data type functionName(parameters) {function body}
c) functionName(parameters) {function body}
d) function functionName(parameters) {function body}
Ans : D

Q.34) What will be the output of the following PHP code?


1. <?php
2. function calc($price, $tax="")
3. {
4. $total = $price + ($price * $tax);
5. echo "$total";
6. }
7. calc(42);
8. ?>
a)Error
b)0
c)42
d) 84
Ans c:

Q.35) Which one of the following databases has PHP supported almost since the
beginning?
a) Oracle Database
b) SQL
c) SQL+
d) MySQL
Ans : D
Q.36) The updated MySQL extension released with PHP 5 is typically referred to
as _______________
a) MySQL
b) mysql
c) mysqli
d) mysqly
Ans : C

Q.37) Which one of the following statements is used to create a table?


a) CREATE TABLE table_name (column_name column_type);
b) CREATE table_name (column_type column_name);
c) CREATE table_name (column_name column_type);
d) CREATE TABLE table_name (column_type column_name);
Ans : A

Q.38) Which method returns the error code generated from the execution of the last
MySQL function?
a) errno()
b) errnumber()
c) errorno()
d) errornumber()
Ans : A

Q.39) Which one of the following statements should be used to include a file?
a) #include „filename‟;
b) include „filename‟;
c) @include „filename‟;
d) #include <filename>;
Ans:B

Q.40) Which one of the following methods is responsible for sending the query to
the database?
a) query()
b) send_query()
c) sendquery()
d) mysqli_query()
Ans : D

Q.41) Which keyword is used to access a static method or property from within the
same class(rather than from child)?
a) static
b) strat
c) self
d) set
Ans : C

Q.42) What does PDO stand for?


a) PHP Data Orientation
b) PHP Database Object
c) PHP Database Orientation
d) PHP Data Object
Ans : D

Q.43) The ........... function is used to read a single character from a file.

A) fgetc()
B) fgets()
C) fget()
D) fgetf()
Ans : A

Q,44) The ............ function checks if the "end-of-file" (EOF) has been reached.

A) f_eof()
B) f_of()
C) feofs()
D) feof()
Ans : D

Q.45) PHP is an open source software

A) True
B) False

Ans : A
Q.46) Which of the following is not valid PHP code?

A) $_10
B) ${“MyVar”}
C) &$something
D) $10_somethings
E) $aVaR
Ans : D

Q.47) Which of the following functions do not return a timestamp?

A) time()
B) date()
C) strtotime()
D) localtime()
Ans : B

Q.48) String values must be enclosed in ......

A) single quotes
B) double quotes
C) both A and B
D) none of above
Ans : C

Q.49) Which is Entry Control Loop


a) For
b) While
c)Do...While Loop
d) A and C both
Ans : D

Q.50) which of the following is not Type of error


a) Syntex
b) Runtime
c) Compile error
d) none of above
Ans : D

51. PHP Stands for?


a). php hypertex processor
b). php hyper markup processor
c). php hyper markup preprocessor
d). php hypertext preprocessor

ANS:d

52. PHP is an example of ___________ scripting language.


a). server-side
b). client-side
c). browser-side
d). in-side

ANS : a

53. Who is known as the father of PHP?


a). rasmus lerdorf
b). willam makepiece
c). drek kolkevi
d). list barely

ANS : a

54. PHP scripts are enclosed within _______


a). <php> . . . </php>
b). <?php . . . ?>
c). ?php . . . ?php
d). <p> . . . </p>

ANS:b

55. Which of the following variables is not a predefined variable?


a). $get
b). $ask
c). $request
d). $post
ANS:b

56. 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( )

ANS : c

57. Which of the following method sends input to a script via a URL?
a). get
b). post
c). both
d). none
ANS : a

58. Which of the following function returns a text in title case from a variable?
a). ucwords($var)
b). upper($var)
c). toupper($var)
d). ucword($var)
ANS : a

59. 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)
ANS:d

60. The practice of separating the user from the true inner workings of an
application through well-known interfaces is known as _________
a). Polymorphism
b). Inheritance
c). Encapsulation
d). Abstraction
ANS : c

61. PHP scripts are executed on _________


a). isp computer
b). client computer
c). server computer
d). it depends on php scripts
ANS:b

62. Which of the following statements prints in PHP?


a). out
b). write
c). echo
d). display
ANS : c

63. In PHP, each statement must be end with ______


a). . (dot)
b). ; (semicolon)
c). / (slash)
d). : (colon)
ANS:b

64. In PHP Language variables name starts with _____


a). ! (exclamation)
b). & (ampersand)
c). * (asterisk)
d). $ (dollar)
ANS : d
65. In PHP Language variables are case sensitive
a). true
b). false
c). depends on website
d). depends on server
ANS : a

66. What is the use of strlen( ) function in PHP?


a). it returns the type of a string
b). it returns the value of a string
c). it returns the length of a string
d). it returns the subset value of a string
ANS : c

67. Which of the following is the Concatenation Operator in PHP?


a). + (plus)
b). . (dot)
c). & (ampersand)
d). % (percentage)
ANS:b

68. Which of the following is not PHP Loops?


a). while
b). do while
c). for
d). do for
ANS : d

69. What is the use of strpos( ) function in PHP?


a). search for a number within a string
b). search for a spaces within a string
c). search for a character/text within a string
d). search for a capitalized string/text with in a string
ANS : c

70. Where setcookie( ) function must appear in PHP?


a). before tag
b). after tag
c). in tag
d). Anywhere
ANS : a

71. What does the hash (#) sign mean in PHP?


a). it indicates lines that are commented out.
b). it indicates variable declaration.
c). it indicates function declaration.
d). No uses in PHP.
ANS : a

72. How to define a variable in PHP?


a). $variable_name = value
b). $variable_name = value;
c). $variable_name == value;
d). $variable_name as value;
ANS:b

73. The uses of strcmp( ) function in PHP?


a). it compare strings including case
b). it compare strings excluding case
c). it compare strings only uppercase
d). it compare strings only lowercase
ANS : a

74. What will be the result of combining a string with another data type in PHP?
a). int
b). float
c). string
d). double
ANS : c

75. Data for a cookie stored in _________ in PHP?


a). in isp computer
b). in user‟s computer
c). in server computer
d). it depends on PHP Coding
ANS:b

76. PHP is a ______ typed language.


a). user
b). loosely
c). server
d). system
ANS:b

77. 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
ANS : a

78. Where session_start() function must appear in PHP?


a). anywhere
b). with <html> tag
c). after <html>tag
d). before <html> tag
ANS : d

79. What does the PHP Interpreter do?


a). it translates user language to system language
b). it creates connection between isp & server
c). it processes the html and php files
d). all of these
ANS : c

80. Which of the following is used to add comments in PHP?


a). //
b). /* … */
c). & … &
d). only a & b
ANS:d

81. What does sprintf() function do in PHP?


a). it sends output to a variable
b). it prints the output of program
c). it sends output to a variable converting into string
d). it prints the output of program converting into string
ANS : a
82. The practice of creating objects based on predefined classes is often referred to
as ______________
a).class creation
b) object creation
c) object instantiation
d) class instantiation
ANS:d

83. Which function displays the information about PHP?


a). info()
b). sysinfo()
c). phpinfo()
d). php_info()
ANS : c

84. What does isset() function do in PHP?


a). there is no such function in php
b). it checks whether variable is set or not
c). it checks whether variable is free or not
d). it checks whether variable is string or integer
ANS:b

85. How PHP files can be accessed?


a). through web browser
b). through html files
c). through web server
d). all of Above
ANS : c

86. function in PHP which starts with __ (double underscore) is known as


__________
a) Magic Function
b) Inbuilt Function
c) Default Function
d) User Defined Function
ANS : a

87.Type Hinting was introduced in which version of PHP?


a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
ANS:b

88. How to define a function in PHP?


a) function {function body}
b) data type functionName(parameters) {function body}
c) functionName(parameters) {function body}
d) function functionName(parameters) {function body}
ANS:d

89.Which of the following PHP functions accepts any number of parameters?


a) func_get_argv()
b) func_get_args()
c) get_argv()
d) get_argc()
ANS:b

90.Which one of the following PHP functions can be used to find files?
a) glob()
b) file()
c) fold()
d) get_file()
ANS : a

91.PHP‟s numerically indexed array begin with position ___________


a) 1
b) 2
c) 0
d) -1
ANS : c

92.Which of the following PHP function will return true if a variable is an array or
false if it is not an array?
a) this_array()
b) is_array()
c) do_array()
d) in_array()
ANS:b
93. Which of the following function is used to get the value of the previous
element in an array?
a) last()
b) before()
c) prev()
d) previous()
ANS : c

94. The practice of separating the user from the true inner workings of an
application through well-known interfaces is known as _________
a) Polymorphism
b) Inheritance
c) Encapsulation
d) Abstraction
ANS : c

95.The practice of creating objects based on predefined classes is often referred to


as ______________
a) class creation
b) object creation
c) object instantiation
d) class instantiation
ANS:d

96.Which one of the following property scopes is not supported by PHP?


a) friendly
b) final
c) public
d) static
ANS : a

97.PHP recognizes constructors by the name _________


a) classname()
b) _construct()
c) function _construct()
d) function __construct()
ANS:d
98.Which one of the following functions is used to determine whether a class
exists?
a) exist()
b) exist_class()
c) class_exist()
d) __exist()
ANS : c

99.Which one of the following keyword is used to inherit our subclass into a
superclass?
a) extends
b) implements
c) inherit
d) include
ANS : a

100.Which keyword is used to refer to properties or methods within the class


itself?
a) private
b) public
c) protected
d) $this
ANS:d

(101) PHP scripts are enclosed within _______


A. <php> . . . </php
B. <?php . . . ?>
C. ?php . . . ?php
D. <p> . . . </p>
Correct Answer : -> B

(102) Who is known as the father of PHP?


A. Rasmus Lerdorf
B. Willam Makepiece
C. Drek Kolkevi
D. List Barely
Correct Answer : -> A
(103) PHP files have a default file extension of.

A. .html
B. .xml
C. .php
D. .ph
Correct Answer : -> C

(104) Which of the following is not true?


A. PHP is a Object oriented language.
B. PHP is a dynamic language
C. PHP need web server
D. PHP can not be embedded into html.
Correct Answer : -> D

(105) Which of the following method sends input to a script via a URL?
A. Get
B. Post
C. Both
D. None
Correct Answer : -> A

(106) Any variables declared in PHP must begin with a _____?

A. @
B. #
C. &
D. $

Correct Answer : -> D

(107) PHP variables are case-sensitive?

A. True
B. False
C. For "sum" variable it is case-sensitive
D. None of the above
Correct Answer : -> A
(108) Variable names in PHP must start with ?

A. letter
B. underscore
C. no numbers
D. All of the above
Correct Answer : -> D

(109) 16. Which of the following is NOT a superglobal variable ?

A. $_SERVER
B. $_GLOBAL
C. $_GET
D. $_POST
Correct Answer : -> B

(110) Which function is used to check whether a variable have a value?

A. header()
B. footer()
C. inset()
D. isset()
Correct Answer : -> D

(111) What is an exception?

A. is a browser
B. Problem arising during runtime
C. syntax error
D. is a IDE
Correct Answer : -> B

(112) To catch the exceptions


A. An object must be created
B. A variable should be created
C. An array should be created
D. A string have to be created
Correct Answer : -> A

(113) Which are the two blocks that are used to check error and handle the error?

A. Do and while
B. Trying and catching
C. Try and catch
D. TryDo and Check
Correct Answer : -> C

(114) The class from which the child class inherits is called ________
i) Child class
ii) Parent class
iii) Sub class
iv) Base class
A. Only i)
B. ii), iii) and iv)
C. Only iii)
D. ii) and iv)
Correct Answer : -> D

(115) Which one of the following function is used to destroy the session?

A. session_destroy()
B. session_start()
C. session_begin()
D. begin_session()
Correct Answer : -> A

(116) In PHP, cookies are set by using the


A. setcookie ( ) function
B. set ( ) function
C. cookie_set ( ) function
D. None of them
Correct Answer : -> A
(117) The file_get_contents function returns the entire contents of a file as
A. Integer
B. String
C. Character
D. None of them
Correct Answer : -> B

(118) Any string can be broken up into an array by using


A. $_POST[ ]
B. explode ( ) function
C. $_GET[ ]
D. Both A and B
Correct Answer : -> D

(119) If you would like to read a file character by character which function do you
use?
A. fopen ( )
B. fread ( )
C. fgetc ( )
D. file ( )
Correct Answer : -> C

(120) Some incorrect word sequence in a program would generate


A. Semantics error
B. Syntax error
C. Runtime error
D. Logical error
Correct Answer : -> B

(121) By default the scope of variable which is defined inside a function is?
A. Global
B. Local
C. Restricted
D. None of them
Correct Answer : -> B

(122)Which one of the following databases has PHP supported almost since the
beginning?
A. Oracle Database
B. SQL
C. SQL+
D. MySQL
Correct Answer : -> D

(123) The ________ function compares the two strings s1 and s2, ignoring the case
of the characters.

A. strtolower()
B. toLowerCase()
C. strcasecmp()
D. lc()
Correct Answer : -> C

(124)Which one of the following statements is used to create a table?


A. CREATE TABLE table_name (column_name column_type);
B. CREATE table_name (column_type column_name);
C. CREATE table_name (column_name column_type);
D. CREATE TABLE table_name (column_type column_name);
Correct Answer : -> A

(125) Which one of the following statements can be used to select the database?
A. $mysqli=select_db('databasename');
B. mysqli=select_db('databasename');
C. mysqli->select_db('databasename');
D. $mysqli->select_db('databasename');
Correct Answer : -> D

(126) Which one of the following statements should be used to include a file?
A. #include „filename‟;
B. include „filename‟;
C. @include „filename‟;
D. #include <filename>;
Correct Answer : -> B

(127) Which one of the following methods is responsible for sending the query to
the database?
A. query()
B. send_query()
C. sendquery()
D. mysqli_query()
Correct Answer : -> D

(128) Which one of the following method is used to retrieve the number of rows
affected by an INSERT, UPDATE, or DELETE query?
A. num_rows()
B. affected_rows()
C. mysqli_affected_rows()
D. changed_rows()
Correct Answer : -> C

(129) What is the full form of DNS?

A. Digital Network System


B. Domain Network System
C. Digital Name Systmem
D. Domain Name System
Correct Answer : -> D

(130) Which one of the following is not a valid class name?


A. ShopProduct
B. Shopproduct
C. Shopproduct1
D. 1shopproduct
Correct Answer : -> D

(131) Which of the following is not an SQL aggregate function?

A. AVG
B. CURRENT_DATE()
C. MIN
D. MAX
Correct Answer : -> B

(132) The ............. statement is used to delete a table.

A. DROP TABLE
B. DELETE TABLE
C. DEL TABLE
D. REMOVE TABLE
Correct Answer : -> A

(133) Which method rolls back the present transaction?


A. commit()
B. rollback()
C. undo()
D. back()
Correct Answer : -> B

(134) Why trim() function is used in php?

A. to remove whitespaces
B. to remove lowercase alphabet
C. to remove uppercase alphabet
D. to remove underscore
Correct Answer : -> A

(135) How many ways user can print output in PHP?

A. 1
B. 2
C. 3
D. 4
Correct Answer : -> B

(136) Which statement is faster among echo and print?

A. echo
B. print
C. echo and print has same speed
D. None of the above
Correct Answer : -> A

(137) What is the default port number of HTTPs?

A. 70
B. 80
C. 90
D. 100
Correct Answer : -> B

(138) Which one of the following function is used to send an email using PHP
script?

A. mail_send()
B. send_mail()
C. mailrr()
D. mail()
Correct Answer : -> D

(139) What does XML stand for?

A. Extra Modern Link


B. Extensible Markup Language
C. Example Markup Language
D. X-Markup Language
Correct Answer : -> B

(140) Which one of the following method is used to retrieve the number of
columns
A. mysql_num_fields()
B. changed_rows
C. new_rows
D. affected_rows
Correct Answer : -> A

(141) Parameter entities can appear in

A. xml file
B. dtd file
C. xsl file
D. Both 1 and 2
Correct Answer : -> B

(142) Full form of DOM


A. Document Object Model
B. Dictionary Object Method
C. Diary Object Model
D. Document Object Method
Correct Answer : -> A

(143) Which one of the following function is used to start a session?

A. start_session()
B. session_start()
C. session_begin()
D. begin_session()
Correct Answer : -> B

(144) Which of the below symbols is a newline character?

A. \d
B. /t
C. \n
D. /p
Correct Answer : -> C

(145) Which of the following is/are a PHP code editor?


A. Adobe Dreamweaver
B. Micrrosoft word
C. internet explorer
D. chrome
Correct Answer : -> A

(146) How should we add a single line comment in our PHP code?

A. /?
B. /@
C. //
D. /*
Correct Answer : -> C

(147) What will be the output of the following PHP code?


1. <?php
2. $num = 1;
3. $num1 = 2;
4. print $num . "+". $num1;
5. ?>
A. 3
B. 1+2
C. 1.+.2
D. Error

Correct Answer : -> B

(148) What will be the output of the following PHP code?

1. <?php
2. $num = 1;
3. $num1 = 2;
4. print $num+$num1;
5. ?>
A. 3
B. 1+2
C Error
D. 12

Correct Answer : -> A

(149)Which of the following is type of array in php

A. Big Arrays
B. circular Arrays
C. Advance arrays
D. Associative arrays
Correct Answer : -> D
(150) An Object is a/an ________ of a class.

A. type
B. prototype
C. instance
D. object

Correct Answer : -> C

You might also like