BCA Fourth Semester Scripting language MCQ Question with answer
- In which php version Exception handling was added
- PHP 5.1
B. PHP 5.2
C. PHP 5.3
D. PHP 5 - what among the following is an appropriate event handler for input text among the below optionsa
- Onclick
- Onchange
- Onkeyup
- Onblur
iii. What is wordpress
- Framework
- CMS
- Programming language
- Operating system
Iv. A function name cannot start with a
- Alphabet
- Underscore
- Number
- Both C and B
- A function in php which starts with double underscore is known as
- Magic function
- Inbuilt Function
- Defult function
- User defined function
- object are created using _______keyword.
- Create
- Object
- New
- None of the above
vii. objects are defined as instances of use defined classes that can hold————-?
- Values
- Functions
- Both values & functions
- None of these
viii. which relational database is used into wordpress?
- Mysql
- Oracle
- postgresSQL
- MSSSQL server
- foreach loop is iterate over…..?
- Number
- String
- Array
- Function
- What is the name of configuration file in wordpress?
- php
- Wp-seting.php
- wp-config.php
- php
Set II
- Variable function directly don’t work with,
a) echo() | b) isset() | ||||||||||||||||||||||||||||||||
c) print() | d) All of the above | ||||||||||||||||||||||||||||||||
2. | The pop() methods of the array does which of the following task? | ||||||||||||||||||||||||||||||||
a) Decrement the total length by 1 | b) Increment the total length by 1 | ||||||||||||||||||||||||||||||||
c) Updates the elements | d) prints the first element but no effect on the length | ||||||||||||||||||||||||||||||||
3. | JavaScript is used to? | ||||||||||||||||||||||||||||||||
a) Define HTML elements | b) User Interface Design | ||||||||||||||||||||||||||||||||
c) Work with behavior of HTML elements | d) None of the above | ||||||||||||||||||||||||||||||||
4. | Sessions allow you to? | ||||||||||||||||||||||||||||||||
a) Store persistent user preference on a site | b) Create multipage forms | ||||||||||||||||||||||||||||||||
c) Save user authentication information from page to page | d) All of above | ||||||||||||||||||||||||||||||||
5. | What will be the output of following code? | ||||||||||||||||||||||||||||||||
$a = 10; | echo ‘Value of a = $a’; | ||||||||||||||||||||||||||||||||
a) Value of a = 10 | b) Value of a = $a | ||||||||||||||||||||||||||||||||
c) Undefined | d) Syntax Error | ||||||||||||||||||||||||||||||||
6. | Which of the following attribute is needed for file upload via form? | ||||||||||||||||||||||||||||||||
a) enctype=’multipart/formdata’ | b) enctype=’singlepart/data’ | ||||||||||||||||||||||||||||||||
|
c) enctype=’file’ | d) enctype=’formdata/file’ | |||||||||||||||||||||||||||||||
7. | Which of the following are the valid PHP data types? | ||||||||||||||||||||||||||||||||
a) Resource | b) null | ||||||||||||||||||||||||||||||||
c) boolean | d) string | ||||||||||||||||||||||||||||||||
e) Both a and c | f) Both b, c and d | ||||||||||||||||||||||||||||||||
- All of the above
- Which of the following variable names are invalid?
a) $var_1 | b) $var1 | ||
c) $var/1 | d) $v1 |
- Function parses an English textual date or time into a UNIX timestamp.
a) strtodate() | b) stroftime() | ||
c) strtotime() | d) str_to_time() |
- Which one of the following statements instantiates the mysqli class?
a) mysqli = new mysqli() | b) $mysqli = new mysqli() | ||
c) $mysqli>new.mysqli() | d) mysqli>new.mysqli() | ||
|
Model mcq Question paper
- The script tag must be placed in
- Head
- Head and body
- Title and head
- All of the aove
MCQ
- The term PHP is an acronym for PHP:_______________.
- Hypertext Preprocessor B. Hypertext multiprocessor
C. Hypertext markup Preprocessor D. Hypertune Preprocessor
- PHP is a ____________ language?
- user-side scripting B. client-side scripting
C. server-side scripting D. Both B and C
- Who among this is the founder of php language?
- Tim Berners-Lee B. Brendan Eich
C. Guido van Rossum D. Rasmus Lerdorf - In which year php was created?
- 1993 B. 1994
C. 1995 D. 1996
- PHP files have a default file extension of_______.
- .html B. .xml
C. .php D. .hphp - Which of the following is the correct syntax of php?
- <?php >\ B. <php >
C. ?php ? D. <?php ?>
- Which of the following is the latest version of php?
- 7.1 B. 7.2
C. 7.3 D. 7.4 - Which of the following is the Release date of latest version (7.2) of php?
- 27 November 2017. B. 28 November 2017.
C. 29 November 2017. D. 30 November 2017. - Which of the below statements is equivalent to $sub -= $sub?
- $sub = $sub B. $sub = $sub -$sub
C. $sub = $sub – 1 D. $sub = $sub – $sub – 1 - Which statement will output $lfc on the screen?
- echo “$lfc”; B. echo “$$lfc”;
C. echo “/$lfc”; D. echo “$lfc;”;
- How many ways user can print output in PHP?
- 1 B. 2
C. 3 D. 4 - print statement can take _____ argument?
- 1 B. 2
C. 3 D. 4 - How many return value does echo statement has?
- 1 B. 2
C. 3 D. 0 - Echo statement is written under parentheses?
- True B. False
C. Only for string it written under parentheses
D. Only for variable it written under parentheses
- Which statement is faster amoung echo and print?
- echo B. print
C. echo and print has same speed D. None of the above - What will be the output of the following PHP code?
<?php
echo “Hello world </br> I am learning PHP at letsfindcourse”;
?>
- Hello world B. Hello world I am learning PHP at letsfindcourse
C. Hello world
I am learning PHP at letsfindcourse D. Error - What will be the output of the following PHP code?
<?php
$five = 5;
print($five);
print $five;
?>
- 05 B. 55
C. 50 D. Error - What will be the output of the following PHP code?
<?php
$a = “Hello”;
$b = “World”;
echo “$a”+”$b”;
?>
- HelloWorld B. Hello+World
C. 0 D. Error
- What will be the output of the following PHP code?
<?php
$a = “hello”;
$b = “world”;
print($a$b);
?>
- helloworld B. hello
C. Nothing D. error - What will be the output of the following PHP code?
<?php
print(“I”.”am”.”learning”.”php”);
?>
- Iamlearningphp B. I am learning php
C. Nothing D. error
- Any variables declared in PHP must begin with a _____?
- . B. #
C. & D. $ - A variable can have ________?
- long descriptive names B. short names
C. Both A and B D. None of the above - A variable name can only contain ____________?
- alphanumeric characters B. underscores
C. Both A and B D. None of the above - Variable names in PHP must start with ?
- letter B. underscore
C. no numbers D. All of the above
- PHP variables are case-sensitive?
- True B. False
C. For “sum” variable it is case-sensitive D. None of the above - How many variable scope are there in php?
- 2 B. 3
C. 1 D. 4 - What will be the output of the following PHP code?
<?php
$x = 1;
$y = 2;
$z = “$x + $y”;
echo “$z”;
?<
- $x + $y B. 3
C. 1+2 D. 12 - What will be the output of the following PHP code?
<?php
$x = 3.3;
$y = 2;
echo $x % $y;
?>
- 1.3 B. 1
C. 0 D. Error - What will be the output of the following PHP code?
<?php
$a = 1;
$b = 2;
$c = 3;
echo ($a % ($b) + $c);
?>
- 2 B. 3
C. 4 D. 5 - What will be the output of the following PHP code?
<?php
$a = 1;
$b = 2;
$c = 3;
echo ($a * (($b) – $c));
?>
- 1 B. -1
C. 2 D. -2 - Variables are ________ for storing information.
- decimal B. storage
C. numbers D. containers - choose the incorrect variable name in php?
- $_AGE B. $18AGE
C. $AGE18 D. $_AGE18
- A variable declared _____ has a GLOBAL SCOPE?
- outside program B. inside function
C. outside function D. None Of the Above - A variable declared _____ has a LOCAL SCOPE?
- outside program B. inside function
C. outside function D. None Of the Above - Which of the following will be output of the following code?
<?php
function myTest() {
static $x;
echo $x;
}
myTest();
?>
- 0 B. 1
C. No Output D. Error
]
- Which of the following is NOT a superglobal variable ?
- $_SERVER B. $_GLOBAL
C. $_GET D. $_POST
- Predict the output of the following code snippet :
<?php
$i=10;
function sample($i)
{
$i++;
echo $i.”,”;
}
echo $i.”,”;
GLOBAL $i;
sample($i);
echo $i;
?>
- 11,11,11 B. 10,11,11
C. 10,11,10 D. 10,10,10 - Predict the output of the following code snippet :
<?php
$i=10;
function sample($i)
{
$i+=2;
GLOBAL $i;
echo $i+$i,”,”;
}
echo $i.”,”;
GLOBAL $i;
sample($i);
echo $i;
?>
- 10,20,10 B. 10,24,10
C. 10,20,20 D. 10,22,10
- Predict the output of the following code snippet :
<?php
function sample()
{
$var1=20;
echo $var1;
echo $GLOBALS[‘var1’];
}
$var1=10;
sample();
echo $var1;
?>
- A. 201010 202010
C. 101010 D. 201020 - what $_SERVER variable do?
- Will give the information about all the predefined variables to know the server information
B. To get the information about the files uploaded using POST methods
C. When the information is passed using POST methods
D. None of the above
- PHP supports ____ types of looping techniques?
- 2 B. 3
C. 4 D. 5 - How many main parameter are used in for loop?
- 2 B. 3
C. 4 D. 1 - do-while loop is an _____ control loop ?
- exit B. exist
C. easy D. entry - while loop is an _____ control loop ?
- exit B. exist
C. easy D. entry - foreach loop is used to iterate over ____?
- number B. object
C. function D. array
- Which loop evaluates the condition expression as Boolean, if it is true, it executes the statements and when it is false it will terminate?
- For loop B. while loop
C. do-while loop D. All of the above
- What will be the output of the following PHP code?
<?php
for ($num = 1; $num <= 10; $num += 2) {
echo “$num “;
}
?>
- 1 3 5 7 9 B. 1 2 3 4 5
C. 9 7 5 3 1 D. Error - What will be the output of the following PHP code?
<?php
$num = 20;
while ($num < 12) {
$num += 2;
echo $num, “\n”;
}
?>
- Error B. No Output
C. infinite loop D. Only one garbage value - What will be the output of the following PHP code?
<?php
$num = 2;
do {
$num += 2;
echo $num, “\n”;
} while ($num < 0);
?>
- Error B. No Output C. infinite loop D. 4
- What will be the output of the following PHP code?
<?php
$arr = array (10, 20, 30);
foreach ($arr as $val) {
echo “$val1 \n”;
}
?>
- 10 20 30 B. No Output C. 10 D. undefined variable