MCQ with answer Scripting language BCA Fourth Semester

5660

BCA Fourth Semester Scripting language MCQ Question with answer

  1. In which php version Exception handling was added
  2. PHP 5.1
    B. PHP 5.2
    C. PHP 5.3
    D. PHP 5
  3. what among the following is an appropriate event handler for input text among the below optionsa
  4. Onclick
  5. Onchange
  6. Onkeyup
  7. Onblur

iii. What is wordpress

  1. Framework
  2. CMS
  3. Programming language
  4. Operating system

Iv. A function name cannot start with a

  1. Alphabet
  2. Underscore
  3. Number
  4. Both C and B
  5. A function in php which starts with double underscore is known as
  6. Magic function
  7. Inbuilt Function
  8. Defult function
  9. User defined function
  10. object are created using _______keyword.
  11. Create
  12. Object
  13. New
  14. None of the above

vii. objects are defined as instances of use defined classes that can hold————-?

  1. Values
  2. Functions
  3. Both values & functions
  4. None of these

viii. which relational database is used into wordpress?

  1. Mysql
  2. Oracle
  3. postgresSQL
  4. MSSSQL server
  5. foreach loop is iterate over…..?
  6. Number
  7. String
  8. Array
  9. Function
  10. What is the name of configuration file in wordpress?
  11. php
  12. Wp-seting.php
  13. wp-config.php
  14. php

Set II

 
 
  1. 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

 

  1. All of the above

 

  1. Which of the following variable names are invalid?

 

a) $var_1 b) $var1
c) $var/1 d) $v1

 

  1. Function parses an English textual date or time into a UNIX timestamp.

 

a) strtodate() b) stroftime()
c) strtotime() d) str_to_time()

 

  1. 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

 

  1. The script tag must be placed in
  2. Head
  3. Head and body
  4. Title and head
  5. All of the aove

 

 

 

MCQ

  1. The term PHP is an acronym for PHP:_______________.
  2. Hypertext Preprocessor   B. Hypertext multiprocessor
    C. Hypertext markup Preprocessor        D. Hypertune Preprocessor

 

  1. PHP is a ____________ language?
  2. user-side scripting B. client-side scripting
    C. server-side scripting D. Both B and C

 

  1. Who among this is the founder of php language?
  2. Tim Berners-Lee B. Brendan Eich
    C. Guido van Rossum D. Rasmus Lerdorf
  3. In which year php was created?
  4. 1993 B. 1994
    C. 1995 D. 1996

 

  1. PHP files have a default file extension of_______.
  2. .html B. .xml
    C. .php D. .hphp
  3. Which of the following is the correct syntax of php?
  4. <?php >\ B. <php >
    C. ?php ? D. <?php ?>

 

  1. Which of the following is the latest version of php?
  2. 7.1 B. 7.2
    C. 7.3 D. 7.4
  3. Which of the following is the Release date of latest version (7.2) of php?
  4. 27 November 2017. B. 28 November 2017.
    C. 29 November 2017. D. 30 November 2017.
  5. Which of the below statements is equivalent to $sub -= $sub?
  6. $sub = $sub B. $sub = $sub -$sub
    C. $sub = $sub – 1 D. $sub = $sub – $sub – 1
  7. Which statement will output $lfc on the screen?
  8. echo “$lfc”; B. echo “$$lfc”;
    C. echo “/$lfc”; D. echo “$lfc;”;

 

 

  1. How many ways user can print output in PHP?
  2. 1 B. 2
    C. 3 D. 4
  3. print statement can take _____ argument?
  4. 1 B. 2
    C. 3 D. 4
  5. How many return value does echo statement has?
  6. 1 B. 2
    C. 3 D. 0
  7. Echo statement is written under parentheses?
  8. True B. False
    C. Only for string it written under parentheses
    D. Only for variable it written under parentheses

 

  1. Which statement is faster amoung echo and print?
  2. echo B. print
    C. echo and print has same speed D. None of the above
  3. What will be the output of the following PHP code?

<?php

echo “Hello world </br> I am learning PHP at letsfindcourse”;

?>

  1. Hello world B. Hello world I am learning PHP at letsfindcourse
    C. Hello world
    I am learning PHP at letsfindcourse D. Error
  2. What will be the output of the following PHP code?

<?php

$five = 5;

print($five);

print $five;

?>

  1. 05 B. 55
    C. 50 D. Error
  2. What will be the output of the following PHP code?

<?php

$a = “Hello”;

$b = “World”;

echo “$a”+”$b”;

?>

  1. HelloWorld B. Hello+World
    C. 0 D. Error

 

  1. What will be the output of the following PHP code?

<?php

$a = “hello”;

$b = “world”;

print($a$b);

?>

  1. helloworld B. hello
    C. Nothing D. error
  2. What will be the output of the following PHP code?

<?php

print(“I”.”am”.”learning”.”php”);

?>

  1. Iamlearningphp B. I am learning php
    C. Nothing D. error

 

  1. Any variables declared in PHP must begin with a _____?
  2. . B. #
    C. & D. $
  3. A variable can have ________?
  4. long descriptive names B. short names
    C. Both A and B D. None of the above
  5. A variable name can only contain ____________?
  6. alphanumeric characters B. underscores
    C. Both A and B D. None of the above
  7. Variable names in PHP must start with ?
  8. letter B. underscore
    C. no numbers D. All of the above

 

  1. PHP variables are case-sensitive?
  2. True B. False
    C. For “sum” variable it is case-sensitive D. None of the above
  3. How many variable scope are there in php?
  4. 2 B. 3
    C. 1 D. 4
  5. What will be the output of the following PHP code?

<?php

$x = 1;

$y = 2;

$z = “$x + $y”;

echo “$z”;

?<

  1. $x + $y B. 3
    C. 1+2 D. 12
  2. What will be the output of the following PHP code?

<?php

$x = 3.3;

$y = 2;

echo $x % $y;

?>

  1. 1.3 B. 1
    C. 0 D. Error
  2. What will be the output of the following PHP code?

<?php

$a = 1;

$b = 2;

$c = 3;

echo ($a % ($b) + $c);

?>

  1. 2 B. 3
    C. 4 D. 5
  2. What will be the output of the following PHP code?

<?php

$a = 1;

$b = 2;

$c = 3;

echo ($a * (($b) – $c));

?>

  1. 1 B. -1
    C. 2 D. -2
  2. Variables are ________ for storing information.
  3. decimal B. storage
    C. numbers D. containers
  4. choose the incorrect variable name in php?
  5. $_AGE B. $18AGE
    C. $AGE18 D. $_AGE18

 

  1. A variable declared _____ has a GLOBAL SCOPE?
  2. outside program B. inside function
    C. outside function D. None Of the Above
  3. A variable declared _____ has a LOCAL SCOPE?
  4. outside program B. inside function
    C. outside function D. None Of the Above
  5. Which of the following will be output of the following code?
    <?php

function myTest() {

static $x;

echo $x;

}

myTest();

?>

  1. 0 B. 1
    C. No Output D. Error

]

  1. Which of the following is NOT a superglobal variable ?
  2. $_SERVER B. $_GLOBAL
    C. $_GET D. $_POST

 

  1. 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;

?>

  1. 11,11,11 B. 10,11,11
    C. 10,11,10 D. 10,10,10
  2. 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;

?>

  1. 10,20,10 B. 10,24,10
    C. 10,20,20 D. 10,22,10

 

  1. Predict the output of the following code snippet :

<?php

function sample()

{

$var1=20;

echo $var1;

echo $GLOBALS[‘var1’];

}

$var1=10;

sample();

echo $var1;

?>

  1. A. 201010 202010
    C. 101010 D. 201020
  2. what $_SERVER variable do?
  3. 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

 

 

  1. PHP supports ____ types of looping techniques?
  2. 2 B. 3
    C. 4 D. 5
  3. How many main parameter are used in for loop?
  4. 2 B. 3
    C. 4 D. 1
  5. do-while loop is an _____ control loop ?
  6. exit B. exist
    C. easy D. entry
  7. while loop is an _____ control loop ?
  8. exit B. exist
    C. easy D. entry
  9. foreach loop is used to iterate over ____?
  10. number B. object
    C. function D. array

 

  1. Which loop evaluates the condition expression as Boolean, if it is true, it executes the statements and when it is false it will terminate?
  2. For loop B. while loop
    C. do-while loop D. All of the above

 

  1. What will be the output of the following PHP code?

<?php

for ($num = 1; $num <= 10; $num += 2) {

echo “$num “;

}

 

?>

  1. 1 3 5 7 9     B. 1 2 3 4 5
    C. 9 7 5 3 1    D. Error
  2. What will be the output of the following PHP code?

<?php

$num = 20;

 

while ($num < 12) {

$num += 2;

echo $num, “\n”;

}

?>

  1. Error B. No Output
    C. infinite loop D. Only one garbage value
  2. What will be the output of the following PHP code?
    <?php

$num = 2;

do {

$num += 2;

echo $num, “\n”;

} while ($num < 0);

?>

  1. Error B. No Output C. infinite loop     D. 4

 

  1. What will be the output of the following PHP code?
    <?php

$arr = array (10, 20, 30);

foreach ($arr as $val) {

echo “$val1 \n”;

}

?>

  1. 10 20 30 B. No Output C. 10       D. undefined variable

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here