Question:
What will be the output of the following PHP code?
<?php$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");$result = array_flip($a1);print_r($result);?>

Choices:
- Array ( [red] => red [green] => green [blue] => blue [yellow] => yellow )
- Array ( [a] => a [b] => b [c] => c [d] => d )
- Array ( [red] => a [green] => b [blue] => c [yellow] => d )
- Array ( [a] => red [b] => green [c] => blue [d] => yellow )


Question:
What will be the output of the following PHP code?
<?php$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");$a2 = array("e" => "red","f" => "green", "g" => "blue");$result = array_intersect($a1, $a2);print_r($result);?>

Choices:
- Array ( [a] => red [b] => green [c] => blue )
- Array ( [a] => red [b] => green [c] => blue [d] => yellow )
- Array ( [e] => red [f] => green [g] => blue )
- Array ( [a] => red [b] => green [c] => blue [d] => yellow [e] => red [f] => green [g] => blue )


Question:
What will be the output of the following PHP code?
<?php$a = array(12, 5, 2);echo(array_product($a));?>

Choices:
- 024
- 120
- 010
- 060


Question:
What will be the output of the following PHP code?
<?php$a = array("a" => "Jaguar", "b" => "Land Rover", "c" => "Audi", "d" => "Maseratti");echo array_search("Audi", $a);?>

Choices:
- a
- b
- c
- d


Question:
What will be the output of the following PHP code?
<?php$city_west = array("NYC", "London");$city_east = array("Mumbai", "Beijing");print_r(array_replace($city_west, $city_east));?>

Choices:
- Array ( [1] => Mumbai [0] => Beijing )
- Array ( [0] => NYC [1] => London )
- Array ( [1] => NYC [0] => London )
- Array ( [0] => Mumbai [1] => Beijing )


Question:
What will be the output of the following PHP code?
<?php$people = array("Peter", "Susan", "Edmund", "Lucy");echo pos($people);?>

Choices:
- Lucy
- Peter
- Susan
- Edmund


Question:
What will be the output of the following PHP code?
<?php$number = range(0, 5);print_r ($number);?>

Choices:
- Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
- Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 )
- Array ( [0] => 5 [1] => 5 [2] => 5 [3] => 5 [4] => 5 [5] => 5 )
- Array ( [0] => 0 [5] => 5 )


Question:
What will be the output of the following PHP code?
<?php$array = array("red", "green");array_push($array, "blue", "yellow");print_r($array);?>

Choices:
- Array ( [0] => red [1] => green [2] => blue [3] => yellow )
- Array ( [0] => blue [1] => yellow [2] => red [3] => green )
- Array ( [0] => red [1] => green )
- Array ( [0] => blue [1] => yellow )


Question:
What will be the output of the following PHP code?
<?php$cars = array("Volvo", "BMW", "Toyota");echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";?>

Choices:
- I like Volvo BMW and Toyota.
- I like Volvo, BMW and Toyota)
- I like Volvo, BMW and Toyota.
- I like. Volvo.,. BMW. and.  Toyota)


Question:
What will be the output of the following PHP code?
<?php$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");print_r(array_change_key_case($age, CASE_UPPER));?>

Choices:
- Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
- Array ( [peter] => 35 [ben] => 37 [joe] => 43 )
- Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
- Array ( [PeTeR] => 35 [BeN] => 37 [Joe] => 43 )


Question:
What will be the output of the following PHP code?
<?php$cars = array("Volvo", "BMW", "Toyota", "Honda", "Mercedes", "Opel");print_r(array_chunk($cars, 2));?>

Choices:
- Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] => Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) )
- Array ( [1] => Array ( [1] => Volvo [2] => BMW ) [2] => Array ( [1] => Toyota [2] => Honda ) [3] => Array ( [1] => Mercedes [2] => Opel ) )
- Array ( [0] => Array ( [0] => Volvo [1] => Volvo ) [1] => Array ( [0] => BMW [1] => BMW ) [2] => Array ( [0] => Toyota [1] => Toyota ) )
- Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )


Question:
What will be the output of the following PHP code?
<?php$fname = array("Peter", "Ben", "Joe");$age = array("35", "37", "43");$c = array_combine($fname, $age);print_r($c);?>

Choices:
- Array ( Peter Ben Joe )
- Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
- Array ( 35 37 43 )
- Array ( “[Peter] => 35” “[Ben] => 37” “[Joe] => 43” )


Question:
What will be the output of the following PHP code?
<?php$a = array("A", "Cat", "Dog", "A", "Dog");print_r(array_count_values($a));?>

Choices:
- Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
- Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
- Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
- Array ( [A] => 2 [Cat] => 1 [Dog] => 1)


Question:
What will be the output of the following PHP code?
<?php$a1 = array("a"=>"red", "b"=>"green", "c"=>"blue", "d"=>"yellow");$a2 = array("e"=>"red", "f"=>"green", "g"=>"blue");$result = array_diff($a1, $a2);print_r($result);?>

Choices:
- Array ( [d] => yellow )
- Array ( [c] => blue )
- Array ( [a] => red )
- Array ( [e] => yellow )


Question:
What will be the output of the following PHP code?
<?php$a1 = array("red", "green");$a2 = array("blue", "yellow");print_r(array_merge($a1, $a2));?>

Choices:
- Array ( [0] => red [1] => green)
- Array ( [0] => blue [1] => yellow [2] => red [3] => green )
- Array ( [0] => red [1] => green [2] => blue [3] => yellow )
- Array ( [0] => blue [1] => yellow )


Question:
What will be the output of the following PHP code?
<?php$a = array("a"=>"red", "b"=>"green", "c"=>"blue");echo array_shift($a);print_r ($a);?>

Choices:
- green
- red
- redArray( [c] => green [c] => blue )
- redArray( [b] => green [c] => blue )


Question:
What will be the output of the following PHP code?
<?php$a = array("red", "green", "blue");array_pop($a);print_r($a);?>

Choices:
- Array ( [0] => red [1] => green )
- Array ( [0] => green [1] => blue )
- Array ( [0] => red [1] => blue )
- Array ( [0] => blue [1] => blue )


Question:
What will be the output of the following PHP code?
    <?php    $fruits = array ("mango", "apple", "pear", "peach");    $fruits = array_flip($fruits);    echo ($fruits[0]);    ?>

Choices:
- mango
- error
- peach
- 0


Question:
What will be the output of the following PHP code?
    <?php    $fruits = array ("mango", "apple", "peach", "pear");    $fruits = asort ($fruits);    printr ($fruits);    ?>

Choices:
- Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
- Array ( [0] => apple [1] => mango [2] => peach [3] => pear )
- Error
- Array ( [1] => apple [0] => mango [3] => peach [2] => pear )


Question:
What will be the output of the following PHP code?
    <?php    $arr = array ("picture1.JPG", "picture2.jpg",    "Picture10.jpg", "picture20.jpg");    sort($arr);    print_r($arr);    ?>

Choices:
- Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )
- Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )
- Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
- Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )


Question:
What will be the output of the following PHP code?
    <?php    $face = array ("A", "J", "Q", "K");    $number = array ("2","3","4", "5", "6", "7", "8", "9", "10");    $cards = array_merge ($face, $number);    print_r ($cards);    ?>

Choices:
- Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
- Array ( [0] => A [1] => 2 [2] => J [3] => 3 [4] => Q [5] => 4 [6] => K [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
- Error
- Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] => A [10] => J [11] => Q [12] => K )


Question:
What will be the output of the following PHP code?
    <?php    $fruits = array ("apple", "mango", "peach", "pear",    "orange");    $subset = array_slice ($fruits, 2);    print_r ($subset);    ?>

Choices:
- Array ( [0] => peach )
- Array ( [0] => apple [1] => mango [2] => peach )
- Array ( [0] => apple [1] => mango )
- Array ( [0] => peach [1] => pear [2] => orange )


Question:
What will be the output of the following PHP code?
    <?php    $fruits = array ("apple", "mango", "peach", "pear",    "orange");    $subset = array_splice ($fruits, 2);    print_r ($fruits);    ?>

Choices:
- Error
- Array ( [0] => apple [1] => mango [2] => peach )
- Array ( [0] => apple [1] => mango )
- Array ( [0] => pear [1] => orange )


Question:
What will be the output of the following PHP code?
    <?php    $number = array ("4", "hello", 2);    echo (array_sum ($number));    ?>

Choices:
- 4hello2
- 4
- 2
- 6


Question:
What will be the output of the following PHP code?
    <?php    $array1 = array ("KA", "LA", "CA", "MA", "TA");    $array2 = array ("KA", "IA", "CA", "GA", "TA");    $inter = array_intersect ($array1, $array2);    print_r ($inter);    ?>

Choices:
- Array ( [0] => KA [1] => LA [2] => CA [3] => MA [4] => TA [5] => IA [6] => GA )
- Array ( [0] => KA [2] => CA [4] => TA )
- Array ( [1] => IA [3] => GA )
- Array ( [1] => LA [3] => MA )


Question:
In the following PHP code, what is/are the properties?
    <?php    class Example     {        public $name;        function Sample()        {            echo "This is an example";        }    }     ?>

Choices:
- echo “This is an example”;
- public $name;
- class Example
- function sample()


Question:
What will be the output of the following PHP code?
    <?php    $num = "123";    if (!filter_var($num, FILTER_VALIDATE_INT))        echo("Integer is not valid");    else        echo("Integer is valid");    ?>

Choices:
- No output is returned
- Integer is not valid
- Integer is valid
- Error


Question:
What will be the output of the following PHP code?
    <?php    $var=300;    $int_options = array("options"=>array ("min_range"=>0, "max_range"=>256));    if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))        echo("Integer is not valid");    else        echo("Integer is valid");    ?>

Choices:
- No output is returned
- Integer is not valid
- Integer is valid
- Error


Question:
What will be the output of the following PHP code?
    <?php    $value = 'car';    $result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);    ?>

Choices:
- FALSE
- TRUE
- NULL
- ERROR


Question:
What will be the output of the following PHP code?
    <?php    function convertSpace($string)    {        return str_replace("_", " ", $string);    }    $string = "Peter_is_a_great_guy!";    echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace"));    ?>

Choices:
- Peter_is_a_great_guy!
- Peterisagreatguy!
- Peter is a great guy!
- Error


Question:
What will be the output of the following PHP code?
    <?php    $username = "jasoN";    if (ereg("([^a-z])",$username))        echo "Username must be all lowercase!";    else        echo "Username is all lowercase!";    ?>

Choices:
- Error
- Username must be all lowercase!
- Username is all lowercase!
- No Output is returned


Question:
What will be the output of the following PHP code?
    <?php    $text = "this is\tsome text that\nwe might like to parse.";    print_r(split("[\n\t]",$text));    ?>

Choices:
- this is	some text that we might like to parse.
- Array ( [0] => some text that [1] => we might like to parse. )
- Array ( [0] => this is [1] => some text that [2] => we might like to parse. )
- [0] => this is [1] => some text that [2] => we might like to parse.


Question:
What will be the output of the following PHP code?
    <?php    $foods = array("pasta", "steak", "fish", "potatoes");    $food = preg_grep("/^s/", $foods);    print_r($food);    ?>

Choices:
- Array ( [0] => pasta [1] => steak [2] => fish [3] => potatoes )
- Array ( [3] => potatoes )
- Array ( [1] => steak   )
- Array ( [0] => potatoes )


Question:
What will be the output of the following PHP code?
    <?php    $title = "O'malley wins the heavyweight championship!";    echo ucwords($title);    ?>

Choices:
- O’Malley Wins The Heavyweight Championship!
- O’malley Wins The Heavyweight Championship!
- O’Malley wins the heavyweight championship!
- o’malley wins the heavyweight championship!


Question:
What will be the output of the following PHP code?
    <?php    echo str_pad("Salad", 5)." is good.";    ?>

Choices:
- SaladSaladSaladSaladSalad is good
- is good SaladSaladSaladSaladSalad
- is good  Salad
- Salad  is good


Question:
What will be the output of the following PHP code?
    <?php    $author = "[email protected]";    $author = str_replace("a","@",$author);    echo "Contact the author of this article at $author.";    ?>

Choices:
- Contact the author of this article at [email protected]@mple.com
- [email protected] the @uthor of this @rticle @t [email protected]@[email protected]
- Contact the author of this article at [email protected]@[email protected]
- Error


Question:
What will be the output of the following PHP code?
    <?php    $url = "[email protected]";    echo ltrim(strstr($url, "@"),"@");    ?>

Choices:
- [email protected]
- nachiketh
- [email protected]
- example.com


Question:
What will be the output of the following PHP code?
    <?php    echo (checkdate(4,31,2010) ? 'Valid' : 'Invalid');    ?>

Choices:
- TRUE
- FALSE
- Valid
- Invalid


Question:
What will be the output of the following code? (If say date is 22/06/2013.)
    <?php    echo "Today is ".date("F d, Y");    ?>

Choices:
- Today is 22 June, 2013
- Today is 22-06-2013
- Today is 06-22-2013
- Today is June 22, 2013


Question:
What will be the output of the following PHP code? (If say date is 22/06/2013.)
    <?php    printf( date("t") );    ?>

Choices:
- 30
- 22
- JUNE
- 2013


Question:
What will be the output of the following PHP code if date is 24/02/2008?
    <?php    $date = new DateTime();    echo $date->format('l,F,js,Y');    ?>

Choices:
- Sunday, February 24th 2008
- Sunday, 02 24 2008
- Sunday, 24 02 2008
- Sunday, 24th February 2008


Question:
What will be the value of the variable $input in the following PHP code?
    <?php    $input = "SwapnaLawrence	you are reallypretty!";    $input = strip_tags($input,"");    echo $input;    ?>

Choices:
- Swapna Lawrence you are really pretty!
- Swapna Lawrence	 you are reallypretty!
- Swapna Lawrence	 you are really pretty!
- Swapna Lawrence you are really<i>pretty</i>!


Question:
Which of the following variables does PHP use to authenticate a user?
i) $_SERVER['PHP_AUTH_USER'].
ii) $_SERVER['PHP_AUTH_USERS'].
iii) $_SERVER['PHP_AUTH_PU'].
iv) $_SERVER['PHP_AUTH_PW'].

Choices:
- i) and ii)
- ii) and iv)
- i) and iv)
- ii) and iii)


Question:
What will be the output of the following PHP code? (Say your previous session username was nachi.)
    unset($_SESSION['username']);    printf("Username now set to: %s", $_SESSION['username']);

Choices:
- Username now set to: nachi
- Username now set to: System
- Username now set to:
- Error


Question:
What will be the output of the following PHP code?
    <?php    $number = array(0,1,two,three,four,5);    $num = preg_grep("/[0-5]/", $number);    print_r($num);    ?>

Choices:
- Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)
- Array([2]=>two [3]=>three [4]=>four)
- Array([1]=> 1)
- Array([0]=>0 [1]=>1 [5]=>5)


Question:
What will be the output of the following PHP code?
    <?php    $name = "What is your name?";    if (preg_match("/name/"),$name)    echo "My name is Will Pitt ";    else    echo "My name is not Will Pitt ";    if (preg_match("/are/"))    echo "I am great";    else    echo "I am not great";        ?>

Choices:
- My name is Will Pitt I am great
- My name is not Will Pitt I am great
- My name is Will Pitt I am not great
- My name is not Will Pitt I am not great


Question:
What will be the output of the following PHP code?
    <?php    $str = "Hello! My name is Cameron Fox. Coffee?";    $find = array('/is/','/coffee/');    $replace = array('/was/','/tea/');    echo preg_replace ($find, $replace, $str);    ?>

Choices:
- Hello! My name was Cameron Fox. tea?
- Hello! My name is Cameron Fox. tea?
- Hello! My name is Cameron Fox. Coffee?
- Hello! My name was Cameron Fox. Coffee?


Question:
What will be the output of the following PHP code?
    <?php    $line = "You like dogs. I hate dogs. We should marry.";    $sen = preg_split('/\./', $line);    print_r($sen);    ?>

Choices:
- You like dogs. I hate dogs. We should marry.
- Array([0]=>You like dogs. I hate dogs. We should marry.)
- Array([0]=>You like dogs. [1]=>I hate dogs. [2]=>We should marry.)
- Error


Question:
What will be the output of the following PHP code?
<?php    class ShopProductWriter    {        public function write( $shopProduct )        {            $str = "{$shopProduct->title}: " .$shopProduct->getProducer() ." ({$shopProduct->price})\n";            print $str;        }    }    $product1 = new ShopProduct( "My Antonia", "Willa", "Cather", 5.99 );    $writer = new ShopProductWriter();    $writer->write( $product1 );?>

Choices:
- Error
- Cather: Willa My Antonia (5.99)
- Willa: Cather My Antonia (5.99)
- My Antonia: Willa Cather (5.99)


Question:
What will be the output of the following PHP code?
<?phpclass MyClass{} $a = new MyClass;var_dump(!($a instanceof stdClass));?>

Choices:
- bool(true)
- bool(false)
- error
- none of the mentioned


Question:
Which one of the following PHP statements is true?
class CopyMe {}$first = new CopyMe();$second = $first;

Choices:
- In PHP 4: $second and $first are 2 distinct objects
- In PHP 5: $second and $first are 2 distinct objects
- In PHP 4: $second and $first refer to one object
- None of the mentioned


Question:
What will be the output of the following PHP code? (Before the version PHP 5.2)
class StringThing {}$st = new StringThing();print $st;

Choices:
- Object Not Found
- Object id #1
- PHP Catchable fatal error
- Cannot initialize object


Question:
What will be the output of the following PHP code?
class Person {    function getName() { return "Bob"; }    function getAge() { return 44; }    function __toString() {        $desc = $this->getName();        $desc .= " (age ".$this->getAge().")";        return $desc;    }}$person = new Person();print $person;

Choices:
- Object Not Found
- PHP Catchable fatal error
- BOB (age 44)
- BOB


Question:
What will be the output of the following PHP code?
class Checkout {    final function totalize()     {        // calculate bill    } } class IllegalCheckout extends Checkout {    final function totalize()     {        // change bill calculation    }}

Choices:
- PHP Fatal error: Class IllegalCheckout may not inherit from final class
- Value of the bill calculated
- PHP Fatal error: Cannot find object
- PHP Fatal error: Cannot override final method


Question:
Which keyword can be used to fix the following PHP error?
    namespace main;
    com\getinstance\util\Debug::helloWorld()
PHP Fatal error: Class 'main\com\getinstance\util\Debug' not found in ...

Choices:
- fix
- join
- use
- namespace


Question:
If I already had a Debug class in the main namespace. What will be the output of the following PHP code?
namespace main;use com\getinstance\util\Debug; class Debug {    static function helloWorld() {        print "hello from main\Debug";    } } Debug::helloWorld();

Choices:
- error
- hello from main
- hello from main\Debug
- debug


Question:
What will be the output of the following PHP code?
<?php"Hello World"?>

Choices:
- Error
- Hello World
- Nothing
- Missing semicolon error


Question:
What will be the output of the following PHP code?
<?phpprint_r "Hello world"?>

Choices:
- Error
- Hello World
- Nothing
- Missing semicolon error


Question:
What will be the output of the following PHP code?
<?php$color = "red";echo "$color";echo "$COLOR";echo "$Color";?>

Choices:
- redredred
- redred
- red
- Error


Question:
What will be the output of the following PHP code?
<?php # echo "Hello world"; echo "# Hello world"; ?>

Choices:
- # Hello world
- Hello world# Hello world
- Hello world
- Error


Question:
What will be the output of the following PHP code?
<?phpecho "<i>Hello World</i>"?>

Choices:
- Hello world
- Hello world in italics
- Nothing
- Error


Question:
What will be the output of the following PHP code?
<?phpecho "echo "Hello World"";?>

Choices:
- Hello world
- echo “Hello world”
- echo Hello world
- Error


Question:
What will be the output of the following PHP code?
<?php<?phpecho "Hello world";?>?>

Choices:
- HELLO WORLD
- Hello world
- Nothing
- Error


Question:
What will be the output of the following PHP code?
<?php$color = red;echo "\$color";?>

Choices:
- red
- $color
- \red
- Error


Question:
What will be the output of the following PHP code?
<?php$color = red;echo "$color" . red ;?>

Choices:
- red red
- red
- error
- nothing


Question:
What will be the output of the following PHP code?
<?php$color1 = red;$color2 = green;echo "$color1"."$color2";?>

Choices:
- red green
- red
- green
- error


Question:
What will be the output of the following PHP code?
<?php$color = "red";$color = "green";echo "$color";?>

Choices:
- red
- green
- red green
- error


Question:
What will be the output of the following PHP code?
<?php$color1 = "red";$color2 = "green";echo "$color1" . "$color2";?>

Choices:
- red
- green
- red green
- redgreen


Question:
What will be the output of the following PHP code?
<?php$color1 = "red";$color2 = "green";echo "$color1" + "$color2";?>

Choices:
- redgreen
- red green
- 0
- error


Question:
What will be the output of the following PHP code?
<?php$color1 = "red";$color2 = "red";echo "$color1" + "$color2";?>

Choices:
- redgreen
- red green
- 0
- 1


Question:
What will be the output of the following PHP code?
<?php$color1 = "red";$color2 = "1";echo "$color1" + "$color2";?>

Choices:
- red1
- red 1
- 0
- 1


Question:
What will be the output of the following PHP code?
<?php$color1 = "1";$color2 = "1";echo "$color1" + "$color2";?>

Choices:
- 11
- 2
- 0
- 1


Question:
What will be the output of the following PHP code?
<?php$color1 = "red";$color2 = "1";$color3 = "grey"echo "$color1" + "$color2" . "$color3";?>

Choices:
- 1grey
- grey
- 0
- red1grey


Question:
What will be the output of the following PHP code?
<?php$x = 5;$y = 10;$z = "$x + $y";echo "$z";?>

Choices:
- 15
- 10 + 5
- $z
- $x + $y


Question:
What will be the output of the following PHP code?
<?php$x = 4;$y = 3;$z = 1;echo "$x = $x + $y + $z";?>

Choices:
- 4 = 4 + 3 + 1
- 8
- 8 = 4 + 3 +1
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 4;$y = 3$z = 1;$z = $z + $x + $y;echo "$z";?>

Choices:
- $z
- 15
- 8
- 1


Question:
What will be the output of the following PHP code?
<?php$x = 3.3;$y = 2;echo $x % $y;?>

Choices:
- 0
- 1
- 2
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 10;$y = 4;$z = 3;echo $x % $y % $z;?>

Choices:
- 0
- 1
- 2
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 10;$y = 4;$z = 3;echo ($x % ($y) + $z);?>

Choices:
- 5
- 3
- 0
- 1


Question:
What will be the output of the following PHP code?
<?php$x = 30;$y = 20;$z = 10;echo $x + $y - $z / ($z - $y);?>

Choices:
- 41
- -4
- -5
- 51


Question:
What will be the output of the following PHP code?
<?php$x = 4;$y = -3;$z = 11;echo 4 + $y * $z / $x;?>

Choices:
- 4.25
- 3.25
- -3.25
- -4.25


Question:
What will be the output of the following PHP code?
<?php$x = 3.5;$y = 2;$z = 2;echo $x / $y / $z;?>

Choices:
- 1.75
- 0.875
- 3.5
- Error


Question:
What will be the output of the following PHP code?
<?phpone = 1;two = 2;three = 3;four = 4;echo "one / two + three / four";?>

Choices:
- 0.75
- 0.05
- 1.25
- Error


Question:
What will be the output of the following PHP code?
<?php$on$e = 1;$tw$o = 2;$thre$e = 3;$fou$r = 4;echo "$on$e / $tw$o + $thre$e / $fou$r"; ?>

Choices:
- 0.75
- 0.05
- 1.25
- Error


Question:
What will be the output of the following PHP code?
<?php$on_e = 1;$tw_o = 2;$thre_e = 3;$fou_r = 4;echo $on_e / $tw_o + $thre_e / $fou_r; ?>

Choices:
- 0.75
- 0.05
- 1.25
- Error


Question:
What will be the output of the following PHP code?
<?php$On_e = 1;$tw_o = 2;$thre_e = 3;$fou_r = 4;echo $on_e / $tw_o + $thre_e / $fou_r;?>

Choices:
- 0.75
- 0.05
- 1.25
- Error


Question:
What will be the output of the following PHP code?
<?phpecho $red;?>

Choices:
- 0
- Nothing
- True
- Error


Question:
What will be the output of the following PHP code?
<?php$four4 = 4;$three3 = 3;$two2 = 2;echo $four4 + $three3 / $two2 - 1;?>

Choices:
- 4.5
- 7
- 3.5
- Error


Question:
What will be the output of the following PHP code?
<?php$4four = 4;$3three = 3;$2two = 2;echo $4four + $3three / $2two - 1;?>

Choices:
- 4.5
- 7
- 3.5
- Error


Question:
What will be the output of the following PHP code?
<?phpint $one = 1;echo "$one";?>

Choices:
- 0
- 1
- $one
- Error


Question:
What will be the output of the following PHP code?
<?phpvar $one = 1;var $two = 2;echo $one / $two * $one / $two * $two;?>

Choices:
- 1
- 0
- 0.5
- Error


Question:
What will be the output of the following PHP code?
<?php$hello = "Hello World";$bye = "Bye";echo $hello;"$bye";?>

Choices:
- Hello World
- Bye
- Hello worldBye
- Error


Question:
What will be the output of the following PHP code?
<?php$x;echo "$x";?>

Choices:
- 0
- 1
- Nothing
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 5;{    $x = 10;    echo "$x";}echo "$x";?>

Choices:
- 1010
- 105
- 510
- error


Question:
What will be the output of the following PHP code?
<?php$x = 5;{    echo "$x";}?>

Choices:
- 0
- 5
- Nothing
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 5;function fun(){    echo "$x";}fun();?>

Choices:
- 0
- 5
- Nothing
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 5;function fun(){    $x = 10;    echo "$x";}fun();echo "$x";?>

Choices:
- 0
- 105
- 510
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 4;$y = 3;function fun($x = 3, $y = 4){    $z = $x+$y/$y+$x;    echo "$z";} echo $x;echo $y;echo $z; fun($x, $y);?>

Choices:
- 43
- 943
- 349
- 439


Question:
What will be the output of the following PHP code?
<?php$x = 4;$y = 3;function fun($x, $y){    $z = $x + $y / $y + $x;    echo "$z";}echo $x;echo $y;echo $z; fun(3, 4);?>

Choices:
- 437
- 439
- 349
- 347


Question:
What will be the output of the following PHP code?
<?phpfunction fun($x,$y){    $x = 4;    $y = 3;    $z = $x + $y / $y + $x;    echo "$z";}fun(3, 4); ?>

Choices:
- 7
- 9
- 0
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 3, 4, 5, 6;echo "$x";?>

Choices:
- 3
- 4
- 6
- Error


Question:
What will be the output of the following PHP code?
<?php$a = 10;$b = 4;$c = fun(10,4);function fun($a,$b){    $b = 3;    return $a - $b + $b - $a; }echo $a;echo $b;echo $c;?>

Choices:
- 104
- 410
- 1400
- 4100


Question:
What will be the output of the following PHP code?
<?php$a = "$winner";$b = "/$looser";echo $a,$b;?>

Choices:
- $winner/$looser
- /$looser
- $looser


Question:
What will be the output of the following PHP code?
<?php$a = "$winner";$b = "\$looser";echo $a, $b;?>

Choices:
- $winner\$looser
- \$looser
- $looser


Question:
What will be the output of the following PHP code?
<?php$a = "$winner";$b = "\\$looser";echo $a, $b;?>

Choices:
- $winner\\$looser
- $looser


Question:
What will be the output of the following PHP code?
<?php$x = 5;$y = 10;function fun(){    $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];} fun();echo $y;?>

Choices:
- 5
- 10
- 15
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 5;$y = 10;function fun(){    $y = $GLOBALS['x'] + $GLOBALS['y'];} fun();echo $y;?>

Choices:
- 5
- 10
- 15
- Error


Question:
What will be the output of the following PHP code?
<?phpfunction fun(){    $x = 0;    echo $x;    $x++;}fun();fun();fun();?>

Choices:
- 012
- 123
- 000
- 111


Question:
What will be the output of the following PHP code?
<?phpfunction fun(){    static $x = 0;    echo $x;    $x++;}fun();fun();fun();?>

Choices:
- 012
- 123
- 111
- Error


Question:
What will be the output of the following PHP code?
<?phpstatic $x = 0;function fun(){    echo $x;    $x++;}fun();fun();fun();?>

Choices:
- 012
- 123
- Nothing
- Error


Question:
What will be the output of the following PHP code?
<?php$x=0;function fun(){    echo $GLOBALS['x'];    $GLOBALS['x']++;}fun();fun();fun();?>

Choices:
- 000
- 012
- 123
- Error


Question:
What will be the output of the following PHP code?
<?php$x = 0;function fun(){    echo $GLOBALS['x'];    $x++;}fun();fun();fun();?>

Choices:
- 000
- 012
- Nothing
- Error


Question:
What will be the output of the following PHP code?
<?phpecho "This", "was", "a", "bad", "idea";?>

Choices:
- This, was, a, bad, idea
- This was a bad idea
- Thiswasabadidea
- Error


Question:
What will be the output of the following PHP code?
<?phpecho "This"."was"."a"."bad"."idea";?>

Choices:
- This, was, a, bad, idea
- This was a bad idea
- Thiswasabadidea
- Error


Question:
What will be the output of the following PHP code?
<?phpecho "This","was"|"a","bad"."idea";?>

Choices:
- Thiswasabadidea
- Thiswasbadidea
- Thiswas a badidea
- Thiswas abadidea


Question:
What will be the output of the following PHP code?
<?php$one = "Hello";$two = "World";echo $one, $two;?>

Choices:
- Hello World
- Hello
- World
- HelloWorld


Question:
What will be the output of the following PHP code?
<?php$one = "Hello";$two = "World";echo "$one$two";?>

Choices:
- HelloWorld
- $one$two
- Hello
- Error


Question:
What will be the output of the following PHP code?
<?php$one = "Hello";$two = "World";echo "$one"+"$two";?>

Choices:
- HelloWorld
- Hello+World
- 0
- Error


Question:
What will be the output of the following PHP code?
<?phpecho "This is <i>India</i>";?>

Choices:
- This is India
- This is India
- This is
- Error


Question:
What will be the output of the following PHP code?
<?php$cars = array("Volvo", "BMW", "Toyota");echo "My car is a {$cars[0]}";?>

Choices:
- My car is a Volvo
- My car is a BMW
- My car is a Toyota
- Error


Question:
What will be the output of the following PHP code?
<?phpprint "echo hello world";?>

Choices:
- echo hello world
- hello world
- nothing
- error


Question:
What will be the output of the following PHP code?
<?php$one = 1;print($one);print $one;?>

Choices:
- 01
- 11
- 10
- Error


Question:
What will be the output of the following PHP code?
<?php$cars = array("Volvo", "BMW", "Toyota");print $cars[2];?>

Choices:
- Volvo
- BMW
- Toyota
- Error


Question:
What will be the output of the following PHP code?
<?php$one = "one";$two = "two";print($one$two);?>

Choices:
- onetwo
- one
- nothing
- error


Question:
What will be the output of the following PHP code?
<?php$one = "one";$two = "two";print($one,$two);?>

Choices:
- onetwo
- one, two
- one
- error


Question:
What will be the output of the following PHP code?
<?php$one = "one";$two = "two";print("$one$two");?>

Choices:
- onetwo
- $one$two
- one
- error


Question:
What will be the output of the following PHP code?
<?php$one = "one";$two = "two";print($one==$two);?>

Choices:
- true
- false
- nothing
- error


Question:
What will be the output of the following PHP code?
<?php$one = "one";$two = "one";print($one == $two);?>

Choices:
- true
- false
- 1
- error


Question:
What will be the output of the following PHP code?
<?phpprint("this"."was"."a"."bad"."idea");?>

Choices:
- thiswasabadidea
- this was a bad idea
- nothing
- error


Question:
What will be the output of the following PHP code?
<?phpdefine("GREETING", "PHP is a scripting language");echo $GREETING;?>

Choices:
- $GREETING
- no output
- PHP is a scripting language
- GREETING


Question:
What will be the output of the following PHP code?
<?phpclass Constants{    define('MIN_VALUE', '0.0');      define('MAX_VALUE', '1.0');      public static function getMinValue()    {        return self::MIN_VALUE;    }    public static function getMaxValue()    {        return self::MAX_VALUE;    }}echo Constants::getMinValue();echo Constants::getMaxValue();?>

Choices:
- 0.01.0
- 01
- No output
- ERROR


Question:
What will be the output of the following PHP code?
<?phpdefine("__LINE__", "PHP is a scripting language");echo __LINE__;?>

Choices:
- PHP is a scripting language
- __LINE__
- 2
- ERROR


Question:
What will be the output of the following PHP code?
<?phpdefine('IF', 42); echo "IF: ", IF;?>

Choices:
- IF:42
- No output
- IF:
- ERROR


Question:
What will be the output of the following PHP code?
<?phpdefine("NEW_GOOD_NAME_CONSTANT", "I have a value");define("OLD_BAD_NAME_CONSTANT", NEW_GOOD_NAME_CONSTANT); echo NEW_GOOD_NAME_CONSTANT;echo OLD_BAD_NAME_CONSTANT; ?>

Choices:
- I have a value
- I have a valueI have a value
- ERROR
- I have a valueNEW_GOO_NAME_CONSTANTS


Question:
What will be the output of the following PHP code?
<?phpdefine("VAR_NAME","test"); ${VAR_NAME} = "value"; echo VAR_NAME;echo ${VAR_NAME}; ?>

Choices:
- test
- testtest
- testvalue
- error, constant value cannot be changed


Question:
What will be the output of the following PHP code?
<?phpclass myObject { }define('myObject::CONSTANT', 'test');echo myObject::CONSTANT; ?>

Choices:
- test
- error
- myObject::CONSTANT
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 10;echo ++$a;echo $a++;echo $a;echo ++$a;?>

Choices:
- 11111213
- 11121213
- 11111212
- 11111112


Question:
What will be the output of the following PHP code?
<?php$a = 12;--$a;echo $a++;?>

Choices:
- 11
- 12
- 10
- error


Question:
What will be the output of the following PHP code?
<?php$x = "test";$y = "this";$z = "also"; $x .= $y .= $z ;echo $x;echo $y;?>

Choices:
- testthisthisalso
- testthis
- testthisalsothisalso
- error at line 4


Question:
What will be the output of the following PHP code?
<?php$x = 1;$y = 2;if (++$x == $y++){    echo "true ", $y, $x;}?>

Choices:
- no output
- true 23
- true 22
- true 33


Question:
What will be the output of the following PHP code?
<?php$y = 2;$w = 4;$y *= $w /= $y;echo $y, $w;?>

Choices:
- 80.5
- 44
- 82
- 42


Question:
What will be the output of the following PHP code?
<?php$y = 2;if ($y-- == ++$y){    echo $y;}?>

Choices:
- 2
- 1
- 3
- no output


Question:
What will be the output of the following PHP code?
<?php$y = 2;if (**$y == 4){    echo $y;}?>

Choices:
- 4
- 2
- error at line2
- no output


Question:
What will be the output of the following PHP code?
<?php$y = 2;if (--$y == 2 || $y xor --$y){    echo $y;}?>

Choices:
- 1
- 0
- 2
- no output


Question:
What will be the output of the following PHP code?
<?php$y = 2;if (--$y <> ($y != $y++)){    echo $y;}?>

Choices:
- 1
- 0
- 2
- no output


Question:
What will be the output of the following PHP code?
<?phpecho $x-- != ++$x;?>

Choices:
- 1
- 0
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$auth = 1;$status = 1;if ($result = (($auth == 1) && ($status != 0))){    print "result is $result<br />";}?>

Choices:
- result is true
- result is 1
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$i = 0;while ($i = 10){       print "hi";}print "hello";?>

Choices:
- hello
- infinite loop
- hihello
- error


Question:
What will be the output of the following PHP code?
<?php$i = "";while ($i = 10){       print "hi";}print "hello";?>

Choices:
- hello
- infinite loop
- hihello
- error


Question:
What will be the output of the following PHP code?
<?php$i = 5;while (--$i > 0){       $i++;    print $i;    print "hello";}?>

Choices:
- 4hello4hello4hello4hello4hello…..infinite
- 5hello5hello5hello5hello5hello…..infinite
- no output
- error


Question:
What will be the output of the following PHP code?
<?php$i = 5;while (--$i > 0 && ++$i){       print $i;}?>

Choices:
- 5
- 555555555…infinitely
- 54321
- error


Question:
What will be the output of the following PHP code?
<?php$i = 5;while (--$i > 0 || ++$i){       print $i;}?>

Choices:
- 54321111111….infinitely
- 555555555…infinitely
- 54321
- 5


Question:
What will be the output of the following PHP code?
<?php$i = 0;while(++$i || --$i){       print $i;}?>

Choices:
- 1234567891011121314….infinitely
- 01234567891011121314…infinitely
- 1
- 0


Question:
What will be the output of the following PHP code?
<?php$i = 0;while (++$i && --$i){       print $i;}?>

Choices:
- 1234567891011121314….infinitely
- 01234567891011121314…infinitely
- no output
- error


Question:
What will be the output of the following PHP code?
<?php$i = 0;while ((--$i > ++$i) - 1){       print $i;}?>

Choices:
- 00000000000000000000….infinitely
- -1-1-1-1-1-1-1-1-1-1…infinitely
- no output
- error


Question:
What will be the output of the following PHP code?
<?php$i = 2;while (++$i){       while ($i --> 0)        print $i;}?>

Choices:
- 210
- 10
- no output
- infinite loop


Question:
What will be the output of the following PHP code?
<?php$i = 2;while (++$i){       while (--$i > 0)        print $i;}?>

Choices:
- 210
- 10
- no output
- infinite loop


Question:
What will be the output of the following PHP code?
<?phpecho 5 * 9 / 3 + 9;?>

Choices:
- 24
- 3.7
- 3.85
- 0


Question:
What will be the output of the following PHP code?
<?phpecho 5 * 9 / 3 + 9?>

Choices:
- 24
- 3.7
- 3.85
- 0


Question:
What will be the output of the following PHP code?
<?php$i = 0;$j = 0;if ($i && ($j = $i + 10)) {    echo "true";}echo $j;?>

Choices:
- 10
- 0
- true0
- true10


Question:
What will be the output of the following PHP code?
<?php$i = 10;$j = 0;if ($i || ($j = $i + 10)) {    echo "true";}echo $j;?>

Choices:
- 20
- true0
- 0
- true20


Question:
What will be the output of the following PHP code?
<?php$i = 1;if ($i++ && ($i == 1))    printf("Yes\n$i");else    printf("No\n$i");?>

Choices:
- No 2
- Yes 1
- Yes 2
- No 1


Question:
What will be the output of the following PHP code?
<?php$a = 1; $b = 3;$d = $a++ + ++$b;echo $d;?>

Choices:
- 5
- 4
- 3
- error


Question:
What will be the output of the following PHP code?
<?php$a = 1; $b = 1; $d = 1;print ++$a + ++$a+$a++; print $a++ + ++$b; print ++$d + $d++ + $a++;?>

Choices:
- 869
- 742
- 368
- error


Question:
What will be the output of the following PHP code?
<?php$a = 10; $b = 10;if ($a = 5)    $b--;print $a;print $b--;?>

Choices:
- 58
- 59
- 109
- 108


Question:
What will be the output of the following PHP code?
<?php$i = 0;$x = $i++; $y = ++$i;print $x; print $y; ?>

Choices:
- 02
- 12
- 01
- 21


Question:
What will be the output of the following PHP code?
<?php $a = 5; $b = -7; $c =0;  $d = ++$a && ++$b || ++$c; print $d; print $a;?>

Choices:
- 16
- 06
- 15
- 05


Question:
What will be the output of the following PHP code?
<?php$b = 1; $c = 4; $a = 5; $d = $b + $c == $a;print $d;?>

Choices:
- 5
- 0
- 10
- 1


Question:
What will be the output of the following PHP code?
<?phpecho 5 * 9 / 3 + 9;?>

Choices:
- 24
- 3.7
- 3.85
- 0


Question:
What will be the output of the following PHP code?
<?php$var1 = 1 + ++5;echo $var1; ?>

Choices:
- no output
- error
- 6
- 7


Question:
What will be the output of the following PHP code?
<?php$var1 = 0;$var1 = ($var1 + 5)++; echo $var1; ?>

Choices:
- 5
- error
- 6
- 7


Question:
What will be the output of the following PHP code?
<?php$var1 = 0;$var1 = $var1++ + 5; echo $var1; ?>

Choices:
- 5
- error
- 6
- 7


Question:
What will be the output of the following PHP code?
<?php$var1 = 0;$var1 = ++$var1 + 5; echo $var1; ?>

Choices:
- 5
- error
- 6
- 7


Question:
What will be the output of the following PHP code?
<?php$var1 = 0;$var1 = $var1 + 5; echo $var1++; ?>

Choices:
- 5
- error
- 6
- 7


Question:
What will be the output of the following PHP code?
<?php$var1 = 1;echo $var1 = ++$var1 % 2 + ++$var1; ?>

Choices:
- 1
- 0
- 2
- 3


Question:
What will be the output of the following PHP code?
<?php $a = 5;$b = -7;$c =0;  $d = ++$a && ++$b || ++$c; print $d;print $a;?>

Choices:
- 16
- 06
- 15
- 05


Question:
What will be the output of the following PHP code?
<?php$var1 = 3;print $var = ++$var;?>

Choices:
- 1
- 0
- 2
- 3


Question:
What will be the output of the following PHP code?
<?php$var1 = 3;print ++$var++;?>

Choices:
- 3
- 4
- 5
- error


Question:
What will be the output of the following PHP code?
<?php$i = 0; $j = 1; $k = 2;print !(($i + $k) < ($j - $k));?>

Choices:
- 1
- true
- false
- 0


Question:
What will be the output of the following PHP code?
<?php$i = 0;$j = 1;$k = 2;print !(( +  + $i + $j) > ($j - $k));?>

Choices:
- 1
- no output
- error
- 0


Question:
What will be the output of the following PHP code?
<?php$i = 0;$j = 1;$k = 2;print (( +  + $i + $j) >! ($j - $k));?>

Choices:
- 1
- no output
- error
- 0


Question:
What will be the output of the following PHP code?
<?php$a = 0x6db7;print $a<<6;?>

Choices:
- 1797568
- no output
- error
- 0x6dc0


Question:
What will be the output of the following PHP code?
<?php$a  =  'a' ;print $a * 2;?>

Choices:
- 192
- 2
- error
- 0


Question:
What will be the output of the following PHP code?
<?php$a  =  '4' ;print  +  + $a;?>

Choices:
- no output
- error
- 5
- 0


Question:
What will be the output of the following PHP code?
<?php$a  =  '12345';print "qwe{$a}rty";?>

Choices:
- qwe12345rty
- qwe{$a}rty
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a  =  '12345';print "qwe".$a."rty";?>

Choices:
- qwe12345rty
- qwe$arty
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a  =  '12345';echo 'qwe{$a}rty';?>

Choices:
- qwe12345rty
- qwe{$a}rty
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a  =  '12345';echo "qwe$arty";?>

Choices:
- qwe12345rty
- qwe$arty
- qwe
- error


Question:
What will be the output of the following PHP code?
<?php$x;if ($x)    print "hi" ;else    print "how are u";?>

Choices:
- how are u
- hi
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$x = 0;if ($x++)    print "hi";else    print "how are u";?>

Choices:
- hi
- no output
- error
- how are u


Question:
What will be the output of the following PHP code?
<?php$x;if ($x == 0)    print "hi" ;else    print "how are u";    print "hello"?>

Choices:
- how are uhello
- hihello
- hi
- no output


Question:
What will be the output of the following PHP code?
<?php$x = 0;if ($x == 1)    if ($x >= 0)        print "true";    else        print "false"; ?>

Choices:
- true
- false
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 1;if ($a--)    print "True";if ($a++)    print "False"; ?>

Choices:
- true
- false
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 1;if (echo $a)    print "True";else    print "False"; ?>

Choices:
- true
- false
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 1;if (print $a)    print "True";else    print "False"; ?>

Choices:
- true
- false
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 10;if (1)     print "all";else     print "some"else     print "none";?>

Choices:
- all
- some
- error
- none


Question:
What will be the output of the following PHP code?
<?php$a = 10;if (0)     print "all"; if  else      print "some"?>

Choices:
- all
- some
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = "";if ($a)     print "all";if else     print "some";?>

Choices:
- all
- some
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = "a";if ($a)     print "all";else     print "some";?>

Choices:
- all
- some
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$x = 10;$y = 20;if ($x > $y + $y != 3)    print "hi" ;else    print "how are u";?>

Choices:
- how are u
- hi
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$x = 10;$y = 20;if ($x > $y && 1||1)    print "hi" ;else    print "how are u";?>

Choices:
- how are u
- hi
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$x = 10;$y = 20;if ($x > $y && 1||1)    print "hi" ;else    print "how are u";?>

Choices:
- how are u
- hi
- error
- no output


Question:
What will be the output of the following PHP code?
<?phpif (-100)    print "hi" ;else    print "how are u";?>

Choices:
- how are u
- hi
- error
- no output


Question:
What will be the output of the following PHP code?
<?phpif (0.1)    print "hi" ;else    print "how are u";?>

Choices:
- how are u
- hi
- error
- no output


Question:
What will be the output of the following PHP code?
<?phpif (0.0)    print "hi" ;else    print "how are u";?>

Choices:
- how are u
- hi
- error
- no output


Question:
What will be the output of the following PHP code?
<?phpif (print "0")    print "hi" ;else    print "how are u";?>

Choices:
- 0how are u
- 0hi
- hi
- how are u


Question:
What will be the output of the following PHP code?
<?php$x = 1;if ($x == 2)    print "hi" ;else if($x = 2)    print $x;else    print "how are u";?>

Choices:
- error
- 2
- hi
- how are u


Question:
What will be the output of the following PHP code?
<?php$x = 1;if ($x = $x&0)    print $x ;else    print "how are u";?>

Choices:
- 0
- 1
- error
- how are u


Question:
What will be the output of the following PHP code?
<?php$x = 1;if ($x = $x&0)    print $x ;else    print "how are u";?>

Choices:
- 0
- 1
- error
- how are u


Question:
What will be the output of the following PHP code?
<?php$x = 1;if ($x = $x&0)    print $x;else    break;?>

Choices:
- 0
- 1
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$x = 10;$y = 5;$z = 3;if ($x / $y / $z)    print "hi";else    print "hello";?>

Choices:
- hi
- hello
- error
- no output


Question:
What will be the output of the following PHP code?
<?phpif (!print "hi")    if (print "hello")print "hi";?>

Choices:
- hi
- hihellohi
- hihi
- no output


Question:
What will be the output of the following PHP code?
<?phpif (print "hi" - 1)    print "hello"?>

Choices:
- hi
- hihello
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$x = 1;if ($x--)    print "hi"    $x--;else    print "hello"?>

Choices:
- hi
- hello
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 10;$b = 11;if ($a < ++$a || $b < ++$b)    print "hello";else    print "hi";?>

Choices:
- hi
- hello
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 2;if ($a-- - --$a - $a)    print "hello";else    print "hi";?>

Choices:
- hi
- hello
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = 2;if ($a-- - --$a - $a)    print "hello";else    print "hi";?>

Choices:
- hi
- hello
- error
- no output


Question:
What will be the output of the following PHP code?
<?php$a = "hello";if ($a.length)    print $a.length;else    print "hi";?>

Choices:
- hellolength
- 5
- hi
- error


Question:
What will be the output of the following PHP code?
<?php$a = "hello";if (strlen($a))    print strlen($a);else    print "hi";?>

Choices:
- hellolength
- 5
- hi
- error


Question:
What will be the output of the following PHP code?
<?php$a = "1";$b = "0";if ((int)$a && $b)     print"hi";else     print "hello";?>

Choices:
- hello
- no output
- hi
- error


Question:
What will be the output of the following PHP code?
<?php$a = "1";switch ($a){case 1:    print "hi";case 2:    print "hello";default:    print "hi1";}?>

Choices:
- hihellohi1
- hi
- hihi1
- hi1


Question:
What will be the output of the following PHP code?
<?php$a = "2";switch ($a){case 1:    print "hi";case 2:    print "hello";    break;default:    print "hi1";}?>

Choices:
- hihellohi1
- hello
- hihi1
- hi1


Question:
What will be the output of the following PHP code?
<?php$a = "1";switch($a){case 1:    break;    print "hi";case 2:    print "hello";    break;default:    print "hi1";}?>

Choices:
- hihellohi1
- no output
- hihi1
- hi1


Question:
What will be the output of the following PHP code?
<?php$a = "1";$a = 1;$b = 1;switch($a){case $a * $b:     print "hi";    break;case $a / $b:    print "hello";    break;default:    print "hi1";}?>

Choices:
- hihellohi1
- hi
- hihello
- hi1


Question:
What will be the output of the following PHP code?
<?php$a = 97;switch($a){case "a":    print "hi";    break;case 97:    print "hello";    break;default:    print "hi1";}?>

Choices:
- hihellohi1
- hi
- hihello
- hello


Question:
What will be the output of the following PHP code?
<?php$b = 1;switch($b){case 1.0:    print "hi";    break;case 1:    print "hello";    break;default:    print "hi1";}?>

Choices:
- hihellohi1
- hi
- hihello
- hello


Question:
What will be the output of the following PHP code?
<?phpconst $b = 1;switch($b){case 1:    print "hi";    break;case 1:    print "hello";    break;default:    print "hi1";}?>

Choices:
- error
- hi
- hihello
- hello


Question:
What will be the output of the following PHP code?
<?php$b = 1;switch(print $b){case 2:    print "hello";    break;case 1:    print "hi";    break;default:    print "hi1";}?>

Choices:
- 1hello
- 1hi
- 1hi1
- error


Question:
What will be the output of the following PHP code?
<?phpswitch($b){case 2:    print "hello";    break;case 1:    print "hi";    break;}?>

Choices:
- hello
- hi
- no output
- error


Question:
What will be the output of the following PHP code?
<?phpswitch($b){case 2:    print "hello";    break;case b:    print "hi";    break;}?>

Choices:
- hello
- hi
- no output
- error


Question:
What will be the output of the following PHP code?
<?phpwhile(){    print "hi";}?>

Choices:
- infinite loop
- hi
- no output
- error


Question:
What will be the output of the following PHP code?
<?phpdo{    print "hi";}while(0);print "hello";?>

Choices:
- infinite loop
- hihello
- hello
- error


Question:
What will be the output of the following PHP code?
<?php$i = 0while ($i < 3){    $i++;}print $i;?>

Choices:
- 2
- 3
- 0
- 1


Question:
What will be the output of the following PHP code?
<?php$i = 0do{    $i++;}while ($i < 3);print $i;?>

Choices:
- 2
- 3
- 0
- 1


Question:
What will be the output of the following PHP code?
<?php$i = 0while ($i++){    print $i;}print $i;?>

Choices:
- 0
- infinite loop
- 01
- 1


Question:
What will be the output of the following PHP code?
<?php$i = "";while($i){       print "hi";}print "hello";?>

Choices:
- hello
- infinite loop
- hihello
- error


Question:
What will be the output of the following PHP code?
<?php$i = "";while ($i){       print "hi";} while($i < 8)    $i++;print "hello";?>

Choices:
- Hi is printed 8 times, hello 7 times and then hi 2 times
- Hi is printed 10 times, hello 7 times
- Hi is printed once, hello 7 times
- Hi is printed once, hello 7 times and then hi 2 times


Question:
What will be the output of the following PHP code?
<?php$i = 0;while($i = 10){       print "hi";}print "hello";?>

Choices:
- hello
- infinite loop
- hihello
- error


Question:
What will be the output of the following PHP code?
<?php$i = "";while ($i = 10){       print "hi";}print "hello";?>

Choices:
- hello
- infinite loop
- hihello
- error


Question:
What will be the output of the following PHP code?
<?php$i = 5;while (--$i > 0){       $i++; print $i; print "hello";}?>

Choices:
- 4hello4hello4hello4hello4hello…..infinite
- 5hello5hello5hello5hello5hello…..infinite
- no output
- error


Question:
What will be the output of the following PHP code?
<?php$i = 5;while (--$i > 0 && ++$i){       print $i;}?>

Choices:
- 5
- 555555555…infinitely
- 54321
- error


Question:
What will be the output of the following PHP code?
<?php$i = 5;while (--$i > 0 || ++$i){       print $i;}?>

Choices:
- 54321111111….infinitely
- 555555555…infinitely
- 54321
- 5


Question:
What will be the output of the following PHP code?
<?php$i = 0;while(++$i || --$i){       print $i;}?>

Choices:
- 1234567891011121314….infinitely
- 01234567891011121314…infinitely
- 1
- 0


Question:
What will be the output of the following PHP code?
<?php$i = 0;while (++$i && --$i){       print $i;}?>

Choices:
- 1234567891011121314….infinitely
- 01234567891011121314…infinitely
- no output
- error


Question:
What will be the output of the following PHP code?
<?php$i = 0;while ((--$i > ++$i) - 1){       print $i;}?>

Choices:
- 00000000000000000000….infinitely
- -1-1-1-1-1-1-1-1-1-1…infinitely
- no output
- error


Question:
What will be the output of the following PHP code?
<?php$i = 2;while (++$i){       while ($i --> 0)        print $i;}?>

Choices:
- 210
- 10
- no output
- infinite loop


Question:
What will be the output of the following PHP code?
<?php$i = 2;while (++$i){       while (--$i > 0)        print $i;}?>

Choices:
- 210
- 10
- no output
- infinite loop


Question:
What will be the output of the following PHP code?
<?php$i = 0;for ($i){    print $i;}?>

Choices:
- 0
- infinite loop
- no output
- error


Question:
What will be the output of the following PHP code?
<?phpfor ($x = 0; $x <= 10; print ++$x){    print ++$x;}?>

Choices:
- 123456789101112
- 12345678910
- 1234567891011
- infinite loop


Question:
What will be the output of the following PHP code?
<?phpfor ($x = 1; $x < 10;++$x){    print "*\t";}?>

Choices:
- infinite loop


Question:
What will be the output of the following PHP code?
<?phpfor ($x = -1; $x < 10;--$x){    print $x;}?>

Choices:
- 123456789101112
- 12345678910
- 1234567891011
- infinite loop


Question:
What will be the output of the following PHP code?
<?php$x;for ($x = -3; $x < -5; ++$x){    print ++$x;}?>

Choices:
- -3-4-5
- -3-4
- infinite loop
- no output


Question:
What will be the output of the following PHP code?
<?phpfor ($i++; $i == 1; $i = 2)    print "In for loop ";print "After loop\n"; ?>

Choices:
- In for loop
- After for loop
- In for loopAfter for loop
- Infinite loop


Question:
What will be the output of the following PHP code?
<?phpfor (1; $i == 1; $i = 2)    print "In for loop ";print "After loop\n";?>

Choices:
- In for loop
- After for loop
- In for loopAfter for loop
- Infinite loop


Question:
What will be the output of the following PHP code?
<?phpfor ($i == 2; ++$i == $i; ++$i)    print "In for loop ";print "After loop\n";?>

Choices:
- In for loopIn for loopIn for loopIn for loop……infinitely
- After for loopAfter for loopAfter for loop……..infinitely
- In for loopAfter for loopIn for loopAfter for loopIn for loopAfter for loop…..infinitely
- After for loop


Question:
What will be the output of the following PHP code?
<?phpfor ($x = 1; $x < 10; $x++)    for ($y = 1; $y < 5; $y++)        print "Hello";?>

Choices:
- Hello….36 times
- Hello….45 times
- Hello….50 times
- Hello….40 times


Question:
What will be the output of the following PHP code?
<?phpfor ($count = 1; $count != 20;$count++){    print $count;    $count++;}?>

Choices:
- Infinite
- 123…….20
- 1357…19
- 13579…21


Question:
What will be the output of the following PHP code?
<?phpfor ($count = 1; $count < 20; $count++);    print $count;?>

Choices:
- 20
- 19
- 12345678910….19
- 12345678910….1920


Question:
What will be the output of the following PHP code?
<?phpfor ($count = 0; $count < 3;$count++);{    print "hi";continue;print "hello";}?>

Choices:
- hihihi
- hihellohihellohihello
- hellohellohello
- hi


Question:
What will be the output of the following PHP code?
<?phpfor ($count = 0; $count<3;$count++);{    print "hi";break;print "hello";}?>

Choices:
- hihihi
- hihellohihellohihello
- hellohellohello
- hi


Question:
What will be the output of the following PHP code?
<?phpfor(++$i; ++$i; ++$i){    print $i;    if ($i == 4)         break;}?>

Choices:
- 24
- 134
- 1234
- 1


Question:
What will be the output of the following PHP code?
<?phpfor ($i = 0;$i = -1;$i = 1){    print $i;    if ($i != 1) 	break;}?>

Choices:
- 0
- infinite loop
- -1
- 1


Question:
What will be the output of the following PHP code?
<?phpfor(;;){   print "10";}?>

Choices:
- 10
- infinite loop
- no output
- error


Question:
What will be the output of the following PHP code?
<?phpfor ($i = 0; -5 ; $i++){    print"i";    if ($i == 3)        break;}?>

Choices:
- 0 1 2 3 4
- 0 1 2 3
- 0 1 2 3 4 5
- error


Question:
What will be the output of the following PHP code?
<?phpfor ($i = 0; 0; $i++) {    print"i";}?>

Choices:
- infinite loop
- 0
- no output
- error


Question:
What will be the output of the following PHP code?
<?phpfor ($i = 0; $i < 5; $i++) {    for ($j = $i; $j > 0; $i--)        print $i;}?>

Choices:
- infinite loop
- 0 1 2 3 4 5
- 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5
- no output


Question:
What will be the output of the following PHP code?
<?phpfor ($i = 0; $i < 5; $i++)  {    for ($j = $i;$j > $i; $i--)        print $i;}?>

Choices:
- infinite loop
- 0 1 2 3 4 5
- 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5
- no output


Question:
What will be the output of the following PHP code?
<?php$user = array("Ashley", "Bale", "Shrek", "Blank");for ($x = 0; $x < count($user); $x++) {    if ($user[$x] == "Shrek") 	    continue;    printf ($user[$x]); }?>

Choices:
- AshleyBaleBlank
- AshleyBale
- AshleyBaleShrek
- No output


Question:
What will be the output of the following PHP code?
<?php$user = array("Ashley", "Bale", "Shrek", "Blank");    for ($x=0; $x < count($user) - 1; $x++)	    {        if ($user[$x++] == "Shrek") 		    continue;        printf ($user[$x]);     }?>

Choices:
- AshleyBaleBlank
- Bale
- AshleyShrek
- BaleBlank


Question:
What will be the output of the following PHP code?
<?php$user = array("Ashley", "Bale", "Shrek", "Blank");for ($x = 0; $x < count($user); $x) {    if ($user[$x++] == "Shrek") 	    continue;    printf ($user[$x]); }?>

Choices:
- AshleyBaleBlank
- BaleShrek
- AshleyBlank
- Bale


Question:
What will be the output of the following PHP code?
<?phpfor ($i = 0; $i % ++$i; $i++) {    print"i";}?>

Choices:
- error
- infinite loop
- no output
- 0


Question:
What will be the output of the following PHP code?
<?phpfor ($i = 0; $i < 5; $i++) {    for(; $i < 5; $i++)                 print"i";}?>

Choices:
- iiiii
- infinite loop
- iiiiiiiiiiiiiiiiiiiiiiiii
- no output


Question:
What will be the output of the following PHP code?
<?php$a = array("hi", "hello", "bye");foreach ($a as $value) {    if (count($a) == 2)	    print $value;         }?>

Choices:
- hihellobye
- infinite loop
- hihello
- no output


Question:
What will be the output of the following PHP code?
<?php$a = array("hi", "hello", "bye");for (;count($a) < 5;) {    if (count($a) == 3)	    print $a;         }?>

Choices:
- ArrayArrayArrayArrayArrayArray….infinitely
- (“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)…infinitely
- hihellobyehihellobyehihellobyehihellobyehihellobyehihellobye…..infinitely
- no output


Question:
What will be the output of the following PHP code?
    <?php    function calc($price, $tax="")    {        $total = $price + ($price * $tax);        echo "$total";     }    calc(42);        ?>

Choices:
- Error
- 0
- 42
- 84


Question:
What will be the output of the following PHP code?
    <?php    function a()    {        function b()        {            echo 'I am b';        }        echo 'I am a';    }    a();    a();    ?>

Choices:
- I am b
- I am bI am a
- Error
- I am a Error


Question:
What will be the output of the following PHP code?
    <?php    function a()      {        function b()        {            echo 'I am b';        }        echo 'I am a';    }    b();    a();    ?>

Choices:
- I am b
- I am bI am a
- Error
- I am a Error


Question:
What will be the output of the following PHP code?
    <?php    $op2 = "blabla";    function foo($op1)    {        echo $op1;        echo $op2;    }    foo("hello");    ?>

Choices:
- helloblabla
- error
- hello
- helloblablablabla


Question:
What will be the output of the following PHP code?
    <?php        function foo($msg)        {            echo "$msg";        }        $var1 = "foo";        $var1("will this work");    ?>

Choices:
- error
- $msg
- 0
- will this work


Question:
What will be the output of the following PHP code?
    <?php       echo "chr(52)";    ?>

Choices:
- 1
- 2
- 3
- 4


Question:
What will be the output of the following PHP code?
    <?php        echo ord ("hi");    ?>

Choices:
- 106
- 103
- 104
- 209


Question:
What will be the output of the following PHP code?
  <?php      echo(atan(0.50));  ?>

Choices:
- 0.11845976421345
- 0.23568451142521
- 0.46364760900081
- 1


Question:
What will be the output of the following PHP code?
   <?php       define("GREETING","Hello you! How are you today?");       echo constant("GREETING");   ?>

Choices:
- Hello you! How are you today?
- GREETING
- GREETING, Hello you! How are you today?
- “GREETING”,”Hello you! How are you today?”


Question:
What will be the output of the following PHP code?
    <?php        define("GREETING1","Hello you! How are you today?");        define("GREETING2","Hello you! How are you today?");        define("GREETING3","Hello you! How are you today?");        echo defined("GREETING");     ?>

Choices:
- 1
- 0
- 3
- 4


Question:
What will be the output of the following PHP code?
<?php    function sum($num1, $num2)    {        $total = $num1 + $num2;        echo "chr($total)";     }    $var1 = "sum";    $var1(5, 44);    ?>

Choices:
- Error
- 49
- 1
- Sum


Question:
What will be the output of the following PHP code?
<?php    function sum($num1, $num2)    {        $total = $num1 + $num2;        echo "cos($total)";     }    sum(5,-5);    ?>

Choices:
- 0
- 1
- 0.5
- -0.5


Question:
What will be the output of the following PHP code?
<?php    function b()    {        echo "b is executed";    }    function a()    {        b();        echo "a is executed";        b();    }    a();  ?>

Choices:
- b is executedb is executedb is executed
- b is executeda is executed
- a is executed
- b is executeda is executedb is executed


Question:
What will be the output of the following PHP code?
<?phpfunction addFunction($num1, $num2){    $sum = $num1 + $num2;    return $sum;}$return_value = addFunction(10, 20);echo "Returned value from the function : $return_value"?>

Choices:
- Returned value from the function : $return_value
- Error
- Returned value from the function : 30
- Returned value from the function :


Question:
What will be the output of the following PHP code?
<?phpfunction sayHello(){   echo "HelloWorld<br />";}$function_holder = "sayHello";$function_holder();?>

Choices:
- No Output
- Error
- sayHello
- HelloWorld


Question:
What will be the output of the following PHP code?
<?phpfunction one(){    echo " this works";    function two()    {        echo "this too works";    }}one();two();?>

Choices:
- error
- this works
- this worksthis too works
- this works this too works


Question:
What will be the output of the following PHP code?
<?phpfunction do($myString){    echo strpos($myString, "donkey",0);}do("The donkey looks like a horse.");?>

Choices:
- 4
- 5
- 2
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?phpfunction one(){    define("const","I am awesome!");    echo constant("const");}one();?>

Choices:
- I am awesome!!
- const
- const, I am awesome!!
- “const”,”I am awesome!”


Question:
What will be the output of the following PHP code?
<?php    $title = "O'malley wins the heavyweight championship!";    echo ucwords($title);?>

Choices:
- O’Malley Wins The Heavyweight Championship!
- O’malley Wins The Heavyweight Championship!
- O’Malley wins the heavyweight championship!
- o’malley wins the heavyweight championship!


Question:
What will be the output of the following PHP code?
<?php    echo str_pad("Salad", 5)." is good.";?>

Choices:
- SaladSaladSaladSaladSalad is good
- is good SaladSaladSaladSaladSalad
- is good Salad
- Salad is good


Question:
What will be the output of the following PHP code?
<?php    echo ucwords("i love my country");?>

Choices:
- I love my country
- i love my Country
- I love my Country
- I Love My Country


Question:
What will be the output of the following PHP code?
<?php    echo lcfirst("welcome to India");?>

Choices:
- welcome to India
- welcome to india
- Welcome to India
- Welcome to india


Question:
What will be the output of the following PHP code?
<?php    echo hex2bin("48656c6c6f20576f726c6421");?>

Choices:
- Hello World!
- welcome to india
- This is PHP!
- MCQ questons


Question:
What will be the output of the following PHP code?
<?php     $str = addslashes('What does "yolo" mean?');    echo($str); ?>

Choices:
- What does /”yolo/” mean?
- What does \\”yolo\\” mean?
- What does \”yolo\” mean?
- \What does \”yolo\” mean?\


Question:
What will be the output of the following PHP code?
<?php    $str = "Hello world. It's a beautiful day.";    print_r (explode(" ",$str));?>

Choices:
- Array ( [0] => Hello [0] => world. [0] => It’s [0] => a [0] => beautiful [0] => day. )
- Array ( [0] => Hello [1] => world. [2] => It’s [3] => a [4] => beautiful [5] => day. )
- Hello world. It’s a beautiful day
- Array ( [1] => Hello [2] => world. [3] => It’s [4] => a [5] => beautiful [6] => day. )


Question:
What will be the output of the following PHP code?
<?php    echo strtr("Hilla Warld","ia","eo");?>

Choices:
- Hilla Warld
- Hello World
- ia
- eo


Question:
What will be the output of the following PHP code?
<?php    echo stripos("I love php, I love php too!","PHP");?>

Choices:
- 3
- 7
- 8
- 10


Question:
What will be the output of the following PHP code?
<?php    function A1($x)    {        switch($x)        {        case 1:             //this statement is the same as if($x == 1)            echo 'Case 1 was executed.';            break;        case 2:             //this statement is the same as if($x == 2)            echo 'Case 2 was executed.';            break;        case 3:             //this statement is the same as if($x == 3)            echo 'Case 3 was executed.';            break;        case 4:             //this statement is the same as if($x == 4)            echo 'Case 4 was executed.';            break;        default:             //this statement is the same as if $x does not equal the other conditions            echo 'Default was executed.';            break;         }    }    A1(9);?>

Choices:
- Case 1 was executed
- Case 2 was executed
- Default was executed
- Case 4 was executed


Question:
What will be the output of the following PHP code?
<?php    function uppercase($string)    {        echo ucwords($string);    }    $wow = "uppercase";    $wow("Time to live king size");?>

Choices:
- TIME TO LIVE KING SIZE
- Time to live king size
- Uppercase
- Time To Live King Size


Question:
What will be the output of the following PHP code?
<?php    function TV($string)    {        echo "my favourite TV show is ".$string;        function b()        {            echo " I am here to spoil this code";        }    }    b();?>

Choices:
- I am here to spoil this code
- Error
- My favourite TV show isI am here to spoil this code
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?php    function TV($string)    {        echo "my favourite TV show is ".$string;        function b()        {            echo " I am here to spoil this code";        }    }    function b()    {        echo " I am here to spoil this code";    }    b();?>

Choices:
- I am here to spoil this code
- Error
- my favourite TV show isI am here to spoil this code
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?php    function TV($string)    {        echo "my favourite TV show is ".$string;        function b()        {            echo " I am here to spoil this code";        }    }    function b()    {        echo " I am here to spoil this code";    }    b();    TV("Sherlock");?>

Choices:
- I am here to spoil this code
- Error
- My favourite TV show isI am here to spoil this code
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?php    function TV($string)    {        echo "my favourite TV show is ".$string;        function b()        {            echo " I am here to spoil this code";        }    }    a("Sherlock");    b();?>

Choices:
- I am here to spoil this code
- Error
- my favourite TV show is SherlockI am here to spoil this code
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?php    function calc($num1, $num2)    {        $total = $num1 * $num2;     }    $result = calc(42, 0);    echo $result;    ?>

Choices:
- Error
- 0
- 42
- 84


Question:
What will be the output of the following PHP code?
<?php    function calc($num1, $num2)    {        $total = $num1 * $num2;        return $total;     }    $result = calc(42, 0);    echo $result;    ?>

Choices:
- Error
- 0
- 42
- 84


Question:
What will be the output of the following PHP code?
<?php    $var = 10;    function one()    {        echo $var;    }    one();?>

Choices:
- Error
- 10
- No Output
- None of the Mentioned


Question:
What will be the output of the following PHP code?
<?php    function mine($m)    {        if ($m < 0)            echo "less than 0";        if ($ >= 0)            echo "Not True";    }    mine(0);?>

Choices:
- Less Than 0
- Not True
- No Output
- None of the Mentioned


Question:
What will be the output of the following PHP code?
<?php $x = 75;$y = 25; function addition(){    $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];}addition();echo $z;?>

Choices:
- 100
- error
- 75
- 25


Question:
What will be the output of the following PHP code?
<?phpfunction 2myfunc(){    echo "Hello World";}2myfunc();?>

Choices:
- Hello World
- No Output
- ERROR
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?phpfunction _func(){    echo "Hello World";}_func();?>

Choices:
- Hello World
- No Output
- ERROR
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?phpfunction test($int){    if ($int == 1)        echo "This Works";    if ($int == 2)        echo "This Too Seems To Work";}test(1);TEST(2);?>

Choices:
- This Works
- This Too Seems To Work
- This WorksThis Too Seems To Work
- ERROR


Question:
What will be the output of the following PHP code?
<?phpfunction mine($num){    $num = 2 + $num;echo $num;}mine(3);?>

Choices:
- 3
- $num
- 5
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?phpfunction mine($num){    $num = 2 + $num;    echo "$num";}mine(3);?>

Choices:
- 3
- $num
- 5
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?php    function string($title);    {        $title = ucwords($title);        echo lcfirst($title);    }    string("you went full retard");?>

Choices:
- You went full retard
- You Went Full Retard
- YOU WENT FULL RETARD
- you Went Full Retard


Question:
What will be the output of the following PHP code?
<?php    function multi($num)    {        if ($num == 3)            echo "I Wonder";        if ($num == 7)            echo "Which One";        if ($num == 8)            echo "Is The";        if ($num == 19)            echo "Correct Answer";    }    $can = stripos("I love php, I love php too!","PHP");    multi($can);?>

Choices:
- I Wonder
- Which One
- Is The
- Correct Answer


Question:
What will be the output of the following PHP code?
<?phpfunction movie($int){    $movies = array("Fight Club", "Kill Bill", "Pulp Fiction");    echo "You Do Not Talk About ". $movie[$integer];}movie(0);?>

Choices:
- You Do Not Talk About Fight Club
- You Do Not Talk About Kill Bill
- You Do Not Talk About Pulp Fiction
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?phpfunction addFunction($num1, $num2){    $sum = $num1 + $num2;    return $sum;}$return_value = addFunction(10, 20);echo "Returned value from the function : " .$return_value?>

Choices:
- Returned value from the function : $return_value
- Error
- Returned value from the function : 30
- Returned value from the function :


Question:
What will be the output of the following PHP code?
<?phpfunction time($string){    echo strtr("Towe Pa55", "ow5", $string);}time("ims");?>

Choices:
- Time Pa55
- Towe Pa55
- Towe Pass
- Time Pass


Question:
What will be the output of the following PHP code?
<?phpfunction constant(){    define("GREETING", "Welcome to Narnia");    echo greeting;}?>

Choices:
- Welcome to Narnia
- greeting
- GREETING
- ERROR


Question:
What will be the output of the following PHP code?
<?phpfunction constant(){    define("GREETING", "Welcome to Narnia",true);    echo greeting;}?>

Choices:
- Welcome to Narnia
- greeting
- GREETING
- ERROR


Question:
What will be the output of the following PHP code?
<?phpfunction start($string){    if ($string < 45)        return 20;    else        return 40;}$t = start(90);if ($t < 20){    echo "Have a good day!";}else{    echo "Have a good night!";}?>

Choices:
- Have a good day!
- Have a good night!
- ERROR
- None of the mentioned


Question:
What will be the output of the following PHP code?
<?phpfunction email(){    $email = ’user@yahoo.com’;    $new = strstr($email, ‘@');    echo $new;}email();?>

Choices:
- user
- [email protected]
- @yahoo.com
- yahoo.com


Question:
What will be the output of the following PHP code?
<?phpfunction string(){    echo strstr("Hello world!", 111);}string();?>

Choices:
- o world!
- Hello world!
- 111
- No Output


Question:
What will be the output of the following Python code?
>>>str="hello">>>str[:2]>>>

Choices:
- he
- lo
- olleh
- hello


Question:
In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed.
>>>x = 13 ? 2

Choices:
- SyntaxError
- NameError
- ValueError
- TypeError


Question:
What will be the output of the following Python code snippet?
def example(a):    a = a + '2'     a = a*2    return a>>>example("hello")

Choices:
- indentation Error
- cannot perform mathematical operation on strings
- hello2
- hello2hello2


Question:
What is the average value of the following Python code snippet?
>>>grade1 = 80>>>grade2 = 90>>>average = (grade1 + grade2) / 2

Choices:
- 85.0
- 85.1
- 95.0
- 95.1


Question:
What will be the value of the following Python expression?
4 + 3 % 5

Choices:
- 4
- 7
- 2
- 0


Question:
Evaluate the expression given below if A = 16 and B = 15.
A % B // A

Choices:
- 0.0
- 0
- 1.0
- 1


Question:
What will be the value of x in the following Python expression?
x = int(43.55+2/2)

Choices:
- 43
- 44
- 22
- 23


Question:
What is the value of the following expression?
2+4.00, 2**4.0

Choices:
- (6.0, 16.0)
- (6.00, 16.00)
- (6, 16)
- (6.00, 16.0)


Question:
What are the values of the following Python expressions?
 2**(3**2)
 (2**3)**2
 2**3**2

Choices:
- 64, 512, 64
- 64, 64, 64
- 512, 512, 512
- 512, 64, 512


Question:
What is the value of the following expression?
8/4/2, 8/(4/2)

Choices:
- (1.0, 4.0)
- (1.0, 1.0)
- (4.0. 1.0)
- (4.0, 4.0)


Question:
What is the value of the following expression?
float(22//3+3/3)

Choices:
- 8
- 8.0
- 8.3
- 8.33


Question:
What will be the output of the following Python expression?
print(4.00/(2.0+2.0))

Choices:
- Error
- 1.0
- 1.00
- 1


Question:
What will be the value of X in the following Python expression?
X = 2+9*((3*12)-8)/10

Choices:
- 30.0
- 30.8
- 28.4
- 27.2


Question:
What will be the output of the following Python expression?
24//6%3, 24//4//2

Choices:
- (1,3)
- (0,3)
- (1,0)
- (3,1)


Question:
Which among the following list of operators has the highest precedence?
 +, -, **, %, /, <<, >>, |


Question:
What will be the value of the following Python expression?
float(4+int(2.39)%2)

Choices:
- 5.0
- 5
- 4.0
- 4


Question:
What will be the value of the following Python expression?
4+2**5//10

Choices:
- 3
- 7
- 77
- 0


Question:
What will be the output of the following Python code snippet if x=1?
x<<2

Choices:
- 8
- 1
- 2
- 4


Question:
What will be the output of the following Python expression?
bin(29)

Choices:
- ‘0b10111’
- ‘0b11101’
- ‘0b11111’
- ‘0b11011’


Question:
What will be the value of x in the following Python expression, if the result of that expression is 2?
x>>2

Choices:
- 8
- 4
- 2
- 1


Question:
What will be the output of the following Python expression?
int(1011)?

Choices:
- 1011
- 11
- 13
- 1101


Question:
What will be the output of the following Python expression if x=15 and y=12?
x & y

Choices:
- b1101
- 0b1101
- 12
- 1101


Question:
What is the value of the following Python expression?
bin(0x8)

Choices:
- ‘0bx1000’
- 8
- 1000
- ‘0b1000’


Question:
What will be the output of the following Python expression?
0x35 | 0x75

Choices:
- 115
- 116
- 117
- 118


Question:
What will be the output of the following Python expression?
4^12

Choices:
- 2
- 4
- 8
- 12


Question:
What will be the value of the following Python expression?
 bin(10-2)+bin(12^4)

Choices:
- 0b10000
- 0b10001000
- 0b1000b1000
- 0b10000b1000


Question:
What will be the output of the following Python code if a=10 and b =20?
a=10
b=20
a=a^b
b=a^b
a=a^b
print(a,b)

Choices:
- 10 20
- 10 10
- 20 10
- 20 20


Question:
What will be the output of the following Python expression?
~100?

Choices:
- 101
- -101
- 100
- -100


Question:
What will be the output of the following Python code snippet?
['hello', 'morning'][bool('')]

Choices:
- error
- no output
- hello
- morning


Question:
What will be the output of the following Python code?
['f', 't'][bool('spam')]

Choices:
- t
- f
- No output
- Error


Question:
What will be the output of the following Python code?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))

Choices:
- Error
- [1, 0, 2, 0, ‘hello’, ”, []]
- [1, 0, 2, ‘hello’, ”, []]
- [1, 2, ‘hello’]


Question:
What will be the output of the following Python code?
class Truth:
	pass
x=Truth()
bool(x)

Choices:
- pass
- true
- false
- error


Question:
What will be the output of the following Python code?
if (9 < 0) and (0 < -9):
    print("hello")
elif (9 > 0) or False:
    print("good")
else:
    print("bad")

Choices:
- error
- hello
- good
- bad


Question:
What will be the output of the following Python code snippet?
not(10<20) and not(10>30)

Choices:
- True
- False
- Error
- No output


Question:
What will be the output of the following Python code snippet?
X=”hi”
print(“05d”%X)

Choices:
- 00000hi
- 000hi
- hi000
- error


Question:
What will be the output of the following Python code snippet?
X=”san-foundry”
print(“%56s”,X)

Choices:
- 56 blank spaces before san-foundry
- 56 blank spaces before san and foundry
- 56 blank spaces after san-foundry
- no change


Question:
What will be the output of the following Python expression if x=456?
print("%-06d"%x)

Choices:
- 000456
- 456000
- 456
- error


Question:
What will be the output of the following Python expression if X=345?
print(“%06d”%X)

Choices:
- 345000
- 000345
- 000000345
- 345000000


Question:
What will be the output of the following Python expression if X = -122?
print("-%06d"%x)

Choices:
- -000122
- 000122
- –00122
- -00122


Question:
What will be the output of the following Python expression if the value of x is 34?
print(“%f”%x)

Choices:
- 34.00
- 34.0000
- 34.000000
- 34.00000000


Question:
What will be the output of the following Python expression if x=56.236?
print("%.2f"%x)

Choices:
- 56.00
- 56.24
- 56.23
- 0056.236


Question:
What will be the output of the following Python expression if x=22.19?
print("%5.2f"%x)

Choices:
- 22.1900
- 22.00000
- 22.19
- 22.20


Question:
What will be the output of the following Python code snippet?
'%d %s %g you' %(1, 'hello', 4.0)

Choices:
- Error
- 1 hello you 4.0
- 1 hello 4 you
- 1 4 hello you


Question:
What will be the output of the python code shown below for various styles of format specifiers?
x=1234
res='integers:...%d...%-6d...%06d' %(x, x, x)
res

Choices:
- ‘integers:…1234…1234  …001234’
- ‘integers…1234…1234…123400’
- ‘integers:…  1234…1234…001234’
- ‘integers:…1234…1234…001234’


Question:
What will be the output of the following Python code snippet?
x=3.3456789
'%f | %e | %g' %(x, x, x)

Choices:
- Error
- ‘3.3456789 | 3.3456789+00 | 3.345678’
- ‘3.345678 | 3.345678e+0 | 3.345678’
- ‘3.345679 | 3.345679e+00 | 3.34568’


Question:
What will be the output of the following Python code snippet?
x=3.3456789
'%-6.2f | %05.2f | %+06.1f' %(x, x, x)

Choices:
- ‘3.35   | 03.35 | +003.3’
- ‘3.3456789 | 03.3456789 | +03.3456789’
- Error
- ‘3.34 | 03.34 | 03.34+’


Question:
What will be the output of the following Python code snippet?
x=3.3456789
'%s' %x, str(x)

Choices:
- Error
- (‘3.3456789’, ‘3.3456789’)
- (3.3456789, 3.3456789)
- (‘3.3456789’, 3.3456789)


Question:
What will be the output of the following Python code snippet?
'%(qty)d more %(food)s' %{'qty':1, 'food': 'spam'}

Choices:
- Error
- No output
- ‘1 more foods’
- ‘1 more spam’


Question:
What will be the output of the following Python code snippet?
a='hello'
q=10
vars()

Choices:
- {‘a’ : ‘hello’, ‘q’ : 10,  ……..plus built-in names set by Python….}
- {……Built in names set by Python……}
- {‘a’ : ‘hello’, ‘q’ : 10}
- Error


Question:
What will be the output of the following Python code?
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')

Choices:
- ‘hello good and morning’
- ‘hello, good, morning’
- ‘hello, good, and morning’
- Error


Question:
What will be the output of the following Python code?
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')

Choices:
- mumbai kolkata & delhi
- Error
- No output
- ‘mumbai, kolkata & delhi’


Question:
What will be the output of the following Python code?
t = '%(a)s, %(b)s, %(c)s'
t % dict(a='hello', b='world', c='universe')

Choices:
- ‘hello, world, universe’
- ‘hellos, worlds, universes’
- Error
- hellos, world, universe


Question:
What will be the output of the following Python code?
'{a}, {0}, {abc}'.format(10, a=2.5, abc=[1, 2])

Choices:
- Error
- ‘2.5, 10, [1, 2]’
- 2.5, 10, 1, 2
- ’10, 2.5, [1, 2]’


Question:
What will be the output of the following Python code?
'{0:.2f}'.format(1.234)

Choices:
- ‘1’
- ‘1.234’
- ‘1.23’
- ‘1.2’


Question:
What will be the output of the following Python code?
'%x %d' %(255, 255)

Choices:
- ‘ff, 255’
- ‘255, 255’
- ‘15f, 15f’
- Error


Question:
What will be the output of the following Python code?
l=list('HELLO')
'first={0[0]}, third={0[2]}'.format(l)

Choices:
- ‘first=H, third=L’
- ‘first=0, third=2’
- Error
- ‘first=0, third=L’


Question:
What will be the output of the following Python code?
l=list('HELLO')
p=l[0], l[-1], l[1:3]
'a={0}, b={1}, c={2}'.format(*p)

Choices:
- Error
- “a=’H’, b=’O’, c=(E, L)”
- “a=H, b=O, c=[‘E’, ‘L’]”
- Junk value


Question:
What will be the output of the following Python code?
hex(255), int('FF', 16), 0xFF

Choices:
- [0xFF, 255, 16, 255]
- (‘0xff’, 155, 16, 255)
- Error
- (‘0xff’, 255, 255)


Question:
What will be the output of the following Python code?
'{a}{b}{a}'.format(a='hello', b='world')

Choices:
- ‘hello world’
- ‘hello’ ‘world’ ‘hello’
- ‘helloworldhello’
- ‘hello’ ‘hello’ ‘world’


Question:
What will be the output of the following Python code?
 D=dict(p='san', q='foundry')
'{p}{q}'.format(**D)

Choices:
- Error
- sanfoundry
- san foundry
- {‘san’, ‘foundry’}


Question:
What will be the output of the following Python code?
'The {} side {1} {2}'.format('bright', 'of', 'life')

Choices:
- Error
- ‘The bright side of life’
- ‘The {bright} side {of} {life}’
- No output


Question:
What will be the output of the following Python code?
'{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456)

Choices:
- Error
- ‘1.234560, 1.22345, 1.23’
- No output
- ‘1.234560, 1.234560, 01.23’


Question:
What will be the output of the following Python code?
'%.2f%s' % (1.2345, 99)

Choices:
- ‘1.2345’, ‘99’
- ‘1.2399’
- ‘1.234599’
- 1.23, 99


Question:
What will be the output of the following Python code?
'%s' %((1.23,),)

Choices:
- ‘(1.23,)’
- 1.23,
- (,1.23)
- ‘1.23’


Question:
What will be the output of the following two codes?
i. '{0}'.format(4.56)
ii. '{0}'.format([4.56,])

Choices:
- ‘4.56’, ‘4.56,’
- ‘4.56’, ‘[4.56]’
- 4.56, [4.56,]
- 4.56, [4.56,]


Question:
In the following Python code, which function is the decorator?
def mk(x):
    def mk1():
        print("Decorated")
        x()
    return mk1
def mk2():
    print("Ordinary")
p = mk(mk2)
p()

Choices:
- p()
- mk()
- mk1()
- mk2()


Question:
The following python code can work with ____ parameters.
def f(x):
    def f1(*args, **kwargs):
           print("Sanfoundry")
           return x(*args, **kwargs)
    return f1

Choices:
- 2
- 1
- any number of
- 0


Question:
Identify the decorator in the snippet of code shown below.
def sf():
     pass
sf = mk(sf)
@f
def sf():
     return

Choices:
- @f
- f
- sf()
- mk


Question:
What will be the output of the following Python code?
class A:
    @staticmethod
    def a(x):
        print(x)
A.a(100)

Choices:
- Error
- Warning
- 100
- No output


Question:
What will be the output of the following Python code?
def d(f):
    def n(*args):
        return '$' + str(f(*args))
    return n
@d
def p(a, t):
    return a + a*t
print(p(100,0))

Choices:
- 100
- $100
- $0
- 0


Question:
What will be the output of the following Python code?
def c(f):
    def inner(*args, **kargs):
        inner.co += 1
        return f(*args, **kargs)
    inner.co = 0
    return inner
@c
def fnc():
    pass
if __name__ == '__main__':
    fnc()
    fnc()
    fnc()
    print(fnc.co)

Choices:
- 4
- 3
- 0
- 1


Question:
What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
    i.upper()
print(x)

Choices:
- [‘ab’, ‘cd’]
- [‘AB’, ‘CD’]
- [None, None]
- none of the mentioned


Question:
What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
    x.append(i.upper())
print(x)

Choices:
- [‘AB’, ‘CD’]
- [‘ab’, ‘cd’, ‘AB’, ‘CD’]
- [‘ab’, ‘cd’]
- none of the mentioned


Question:
What will be the output of the following Python code?
i = 1
while True:
    if i%3 == 0:
        break
    print(i)

    i + = 1

Choices:
- 1 2
- 1 2 3
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
i = 1
while True:
    if i%0O7 == 0:
        break
    print(i)
    i += 1

Choices:
- 1 2 3 4 5 6
- 1 2 3 4 5 6 7
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
i = 5
while True:
    if i%0O11 == 0:
        break
    print(i)
    i += 1

Choices:
- 5 6 7 8 9 10
- 5 6 7 8
- 5 6
- error


Question:
What will be the output of the following Python code?
i = 5
while True:
    if i%0O9 == 0:
        break
    print(i)
    i += 1

Choices:
- 5 6 7 8
- 5 6 7 8 9
- 5 6 7 8 9 10 11 12 13 14 15 ….
- error


Question:
What will be the output of the following Python code?
i = 1
while True:
    if i%2 == 0:
        break
    print(i)
    i += 2

Choices:
- 1
- 1 2
- 1 2 3 4 5 6 …
- 1 3 5 7 9 11 …


Question:
What will be the output of the following Python code?
i = 2
while True:
    if i%3 == 0:
        break
    print(i)
    i += 2

Choices:
- 2 4 6 8 10 …
- 2 4
- 2 3
- error


Question:
What will be the output of the following Python code?
i = 1
while False:
    if i%2 == 0:
        break
    print(i)
    i += 2

Choices:
- 1
- 1 3 5 7 …
- 1 2 3 4 …
- none of the mentioned


Question:
What will be the output of the following Python code?
True = False
while True:
    print(True)
    break

Choices:
- True
- False
- None
- none of the mentioned


Question:
What will be the output of the following Python code?
i = 0
while i < 5:
    print(i)
    i += 1
    if i == 3:
        break
else:
    print(0)

Choices:
- 0 1 2 0
- 0 1 2
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
i = 0
while i < 3:
    print(i)
    i += 1
else:
    print(0)

Choices:
- 0 1 2 3 0
- 0 1 2 0
- 0 1 2
- error


Question:
What will be the output of the following Python code?
x = "abcdef"
while i in x:
    print(i, end=" ")

Choices:
- a b c d e f
- abcdef
- i i i i i i …
- error


Question:
What will be the output of the following Python code?
x = "abcdef"
i = "i"
while i in x:
    print(i, end=" ")

Choices:
- no output
- i i i i i i …
- a b c d e f
- abcdef


Question:
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
    print(i, end = " ")

Choices:
- no output
- i i i i i i …
- a a a a a a …
- a b c d e f


Question:
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
    print('i', end = " ")

Choices:
- no output
- i i i i i i …
- a a a a a a …
- a b c d e f


Question:
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
    x = x[:-1]
    print(i, end = " ")

Choices:
- i i i i i i
- a a a a a a
- a a a a a
- none of the mentioned


Question:
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x[:-1]:
    print(i, end = " ")

Choices:
- a a a a a
- a a a a a a
- a a a a a a …
- a


Question:
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
    x = x[1:]
    print(i, end = " ")

Choices:
- a a a a a a
- a
- no output
- error


Question:
What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x[1:]:
    print(i, end = " ")

Choices:
- a a a a a a
- a
- no output
- error


Question:
What will be the output of the following Python code?
x = 'abcd'
for i in x:
    print(i)
    x.upper()

Choices:
- a B C D
- a b c d
- A B C D
- error


Question:
What will be the output of the following Python code?
x = 'abcd'
for i in x:
    print(i.upper())

Choices:
- a b c d
- A B C D
- a B C D
- error


Question:
What will be the output of the following Python code?
x = 'abcd'
for i in range(x):
    print(i)

Choices:
- a b c d
- 0 1 2 3
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
    print(i)

Choices:
- a b c d
- 0 1 2 3
- error
- 1 2 3 4


Question:
What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
    print(i.upper())

Choices:
- a b c d
- 0 1 2 3
- error
- 1 2 3 4


Question:
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
    i.upper()
print (x)

Choices:
- a b c d
- 0 1 2 3
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
    x[i].upper()
print (x)

Choices:
- abcd
- ABCD
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
    i[x].upper()
print (x)

Choices:
- abcd
- ABCD
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
    x = 'a'
    print(x)

Choices:
- a
- abcd abcd abcd
- a a a a
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
x = 'abcd'
for i in range(len(x)):
    print(x)
    x = 'a'

Choices:
- a
- abcd abcd abcd abcd
- a a a a
- none of the mentioned


Question:
What will be the output of the following Python code?
x = 123
for i in x:
    print(i)

Choices:
- 1 2 3
- 123
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for i in d:
    print(i)

Choices:
- 0 1 2
- a b c
- 0 a 1 b 2 c
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d:
    print(x, y)

Choices:
- 0 1 2
- a b c
- 0 a 1 b 2 c
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
    print(x, y)

Choices:
- 0 1 2
- a b c
- 0 a 1 b 2 c
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.keys():
    print(d[x])

Choices:
- 0 1 2
- a b c
- 0 a 1 b 2 c
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
    print(x)

Choices:
- 0 1 2
- a b c
- 0 a 1 b 2 c
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
    print(d[x])

Choices:
- 0 1 2
- a b c
- 0 a 1 b 2 c
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d.values():
    print(x)

Choices:
- 0 1 2
- None None None
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d:
    print(x)

Choices:
- 0 1 2
- {0, 1, 2} {0, 1, 2} {0, 1, 2}
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d:
    print(d.add(x))

Choices:
- 0 1 2
- 0 1 2 0 1 2 0 1 2 …
- None None None
- None of the mentioned


Question:
What will be the output of the following Python code?
for i in range(0):
    print(i)

Choices:
- 0
- no output
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
for i in range(2.0):
    print(i)

Choices:
- 0.0 1.0
- 0 1
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
for i in range(int(2.0)):
    print(i)

Choices:
- 0.0 1.0
- 0 1
- error
- none of the mentioned


Question:
What will be the output of the following Python code?
for i in range(float('inf')):
    print (i)

Choices:
- 0.0 0.1 0.2 0.3 …
- 0 1 2 3 …
- 0.0 1.0 2.0 3.0 …
- none of the mentioned


Question:
What will be the output of the following Python code?
for i in range(int(float('inf'))):
    print (i)

Choices:
- 0.0 0.1 0.2 0.3 …
- 0 1 2 3 …
- 0.0 1.0 2.0 3.0 …
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
for i in [1, 2, 3, 4][::-1]:
    print (i)

Choices:
- 1 2 3 4
- 4 3 2 1
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
for i in ''.join(reversed(list('abcd'))):
    print (i)

Choices:
- a b c d
- d c b a
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
for i in 'abcd'[::-1]:
    print (i)

Choices:
- a b c d
- d c b a
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
for i in '':
    print (i)

Choices:
- None
- (nothing is printed)
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
x = 2
for i in range(x):
    x += 1
    print (x)

Choices:
- 0 1 2 3 4 …
- 0 1
- 3 4
- 0 1 2 3


Question:
What will be the output of the following Python code snippet?
x = 2
for i in range(x):
    x -= 2
    print (x)

Choices:
- 0 1 2 3 4 …
- 0 -2
- 0
- error


Question:
What will be the output of the following Python code?
for i in range(10):
    if i == 5:
        break
    else:
        print(i)
else:
    print("Here")

Choices:
- 0 1 2 3 4 Here
- 0 1 2 3 4 5 Here
- 0 1 2 3 4
- 1 2 3 4 5


Question:
What will be the output of the following Python code?
for i in range(5):
    if i == 5:
        break
    else:
        print(i)
else:
    print("Here")

Choices:
- 0 1 2 3 4 Here
- 0 1 2 3 4 5 Here
- 0 1 2 3 4
- 1 2 3 4 5


Question:
What will be the output of the following Python code?
x = (i for i in range(3))
for i in x:
    print(i)

Choices:
- 0 1 2
- error
- 0 1 2 0 1 2
- none of the mentioned


Question:
What will be the output of the following Python code?
x = (i for i in range(3))
for i in x:
    print(i)
for i in x:
    print(i)

Choices:
- 0 1 2
- error
- 0 1 2 0 1 2
- none of the mentioned


Question:
What will be the output of the following Python code?
string = "my name is x"
for i in string:
    print (i, end=", ")

Choices:
- m, y,  , n, a, m, e,  , i, s,  , x,
- m, y,  , n, a, m, e,  , i, s,  , x
- my, name, is, x,
- error


Question:
What will be the output of the following Python code?
string = "my name is x"
for i in string.split():
    print (i, end=", ")

Choices:
- m, y,  , n, a, m, e,  , i, s,  , x,
- m, y,  , n, a, m, e,  , i, s,  , x
- my, name, is, x,
- error


Question:
What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
for a[-1] in a:
    print(a[-1])

Choices:
- 0 1 2 3
- 0 1 2 2
- 3 3 3 3
- error


Question:
What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
for a[0] in a:
    print(a[0])

Choices:
- 0 1 2 3
- 0 1 2 2
- 3 3 3 3
- error


Question:
What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]
i = -2
for i not in a:
    print(i)
    i += 1

Choices:
- -2 -1
- 0
- error
- none of the mentioned


Question:
What will be the output of the following Python code snippet?
string = "my name is x"
for i in ' '.join(string.split()):
    print (i, end=", ")

Choices:
- m, y,  , n, a, m, e,  , i, s,  , x,
- m, y,  , n, a, m, e,  , i, s,  , x
- my, name, is, x,
- error


Question:
What will be the output of the following Python statement?
>>>"a"+"bc"

Choices:
- a
- bc
- bca
- abc


Question:
What will be the output of the following Python statement?
>>>"abcd"[2:]

Choices:
- a
- ab
- cd
- dc


Question:
What will be the output of the following Python code?
>>> str1 = 'hello'>>> str2 = ','>>> str3 = 'world'>>> str1[-1:]

Choices:
- olleh
- hello
- h
- o


Question:
What will be the output of the following Python code?
>>>print (r"\nhello")

Choices:
- a new line and hello
- \nhello
- the letter r and then hello
- error


Question:
What will be the output of the following Python statement?
>>>print('new' 'line')

Choices:
- Error
- Output equivalent to print ‘new\nline’
- newline
- new line


Question:
What will be the output of the following Python code?
>>>str1="helloworld">>>str1[::-1]

Choices:
- dlrowolleh
- hello
- world
- helloworld


Question:
What will be the output of the following Python code?
print(0xA + 0xB + 0xC)

Choices:
- 0xA0xB0xC
- Error
- 0x22
- 33


Question:
What will be the output of the following Python code?
class father:    def __init__(self, param):        self.o1 = param class child(father):    def __init__(self, param):        self.o2 = param >>>obj = child(22)>>>print "%d %d" % (obj.o1, obj.o2)

Choices:
- None None
- None 22
- 22 None
- Error is generated


Question:
What will be the output of the following Python code?
class tester:    def __init__(self, id):        self.id = str(id)        id="224" >>>temp = tester(12)>>>print(temp.id)

Choices:
- 224
- Error
- 12
- None


Question:
What will be the output of the following Python code?
>>>example = "snow world">>>print("%s" % example[4:7])

Choices:
- wo
- world
- sn
- rl


Question:
What will be the output of the following Python code?
>>>example = "snow world">>>example[3] = 's'>>>print example

Choices:
- snow
- snow world
- Error
- snos world


Question:
What will be the output of the following Python code?
>>>max("what are you")

Choices:
- error
- u
- t
- y


Question:
What will be the output of the following Python code?
>>>example = "helle">>>example.find("e")

Choices:
- Error
- -1
- 1
- 0


Question:
What will be the output of the following Python code?
>>>example = "helle">>>example.rfind("e")

Choices:
- -1
- 4
- 3
- 1


Question:
What will be the output of the following Python code?
>>>example="helloworld">>>example[::-1].startswith("d")

Choices:
- dlrowolleh
- True
- -1
- None