The document is an assignment for a PHP and MySQL course at Ganpat University, containing multiple-choice questions (MCQs) and long questions related to PHP programming concepts. It covers topics such as conditional statements, output of code snippets, looping techniques, and specific loop types in PHP. Additionally, it includes explanations and examples for various PHP constructs like switch case, if-else ladder, and foreach loop.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
11 views3 pages
PHP Assignmnet-2
The document is an assignment for a PHP and MySQL course at Ganpat University, containing multiple-choice questions (MCQs) and long questions related to PHP programming concepts. It covers topics such as conditional statements, output of code snippets, looping techniques, and specific loop types in PHP. Additionally, it includes explanations and examples for various PHP constructs like switch case, if-else ladder, and foreach loop.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
GANPAT UNIVERSITY, KHERVA
BSPP/IOT, COMPUTER ENGINEERING DEPARTMENT
ASSIGNMENT-2 PHP & MySQL (1IT2402) MCQ 1. Which of the following statements are conditional statements in PHP?- A. If statements B.If else statements C. Switch statements D. Loop statements A) A and B B) C C) A, B, and C D) A, B, C, and D 2. What is the correct output of the given code snippets? <?php $num = 20; if ($num) { echo "Hello"; } else { echo "Hii"; } ?> A) Hello B) Hi C) Error D) None of the above 3. What is the correct output of the given code snippets? <?php if (echo("India ")) { echo "Hello"; } else { echo "Hii"; } ?> A) India Hello B) India Hii C) Error D) None of the above 4. What is the correct output of the given code snippets? <?php if (print("India ")) { echo "Hello"; } else { echo "Hii"; } ?> A) India Hello B) India Hii C) Error D) None of the above
5. What is the correct output of the given code snippets?
<?php $num1 = 10; $num2 = 20; $num3 = 30; if ($num1 > $num2 && $num1>$num3) echo $num1; else if($num2 > $num1 && $num2>$num3) echo $num2; else echo $num3; ?> A) 10 B) 20 C) 30 D) Error
6. PHP supports ____ types of looping techniques?
A) 2 B) 3 C) 4 D) 5
7. How many main parameter are used in for loop?
A) 2 B) 3 C) 4 D) 1
8. Do-while loop is an _____ control loop?
A) exit B) exist C) easy D) entry 9. While loop is an _____ control loop? A) exit B) exist C) easy D) entry
10.foreach loop is used to iterate over ____?
A) Number B) onject C) function D) Array
Long Questions
1. Explain Switch case in PHP with Example.
2. Explain if….else if…ladder in PHP with Example. 3. Explain for loop in PHP with example. 4. Explain difference between entry controlled loop and exit controlled loop with example. 5. Explain Foreach loop with example.