PHP Conditional Statements Quiz

TrustingPeridot avatar
TrustingPeridot
·
·
Download

Start Quiz

Study Flashcards

21 Questions

Match the following conditional statement with its syntax:

If-else statement = If( 1st condition) { Execute statement(s )if condition is true; } { elseif( 2nd condition )Execute statement(s) if 2nd condition is true; }Else{ Execute statement(s) if both conditions are false; } Switch case statement = switch (n) { case label 1: code to be executed if n=label 1; break; case label 2: code to be executed if n=label 2; case label 3: code to be executed if n=label 3; … default: code to be executed if n is different from all labels; }

Match the following programming languages with their primary usage:

PHP = Write a program to check student grade based on marks Python = General-purpose programming JavaScript = Client-side scripting for web applications SQL = Database queries

Match the following user input with its expected output:

User input: 76 = Output : D grade User input: 90 = Output : A+ grade User input: 60 = Output : C grade User input: 50 = Output : Fail

Match the following looping structure with its related programming language:

PHP Loops = LOOPING STRUCTURE PHP LOOPS JavaScript Loops = Client-side scripting for web applications Python Loops = General-purpose programming SQL Loops = Not applicable

Match the following with their usage in web development:

CSS = Styling web pages JavaScript = Client-side scripting for web applications PHP = Server-side scripting for web applications SQL = Database queries

Match the following PHP conditional statements with their descriptions:

if statement = Executes code if one condition is true if...else statement = Executes code if a condition is true and another code if that condition is false if...elseif...else statement = Executes different codes for more than two conditions switch statement = Executes different codes based on the value of a variable

Match the following PHP conditional statement syntax with their corresponding statements:

if( condition ) { Execute statement(s) if condition is true; } = if statement If (condition) { Execute statement (s) if condition is true; } Else{ Execute statement(s) if condition is false; } = if...else statement if( condition ) { Execute statement(s) if condition is true; } Elseif( condition ) { Execute statement(s) if condition is true; } Else{ Execute statement(s) if condition is false; } = if...elseif...else statement switch(expression) { case label1: code to be executed if expression = label1; break; case label2: code to be executed if expression = label2; break; default: code to be executed if expression is different from all labels; } = switch statement

Match the following learning objectives with their descriptions:

To understand the importance of conditional statement = Recognizing the significance of conditional statements in programming To know different type of conditional statements in PHP = Identifying the various conditional statement types available in PHP To know the basic fundamental logic creation using conditional statement = Understanding the fundamental logic creation using conditional statements To apply the PHP syntax using conditional statements in creating a website = Implementing PHP syntax for conditional statements in website development

Match the following programming language features with their descriptions:

Variables = Used for storing data values Functions = Blocks of code that perform a specific task Syntax = Set of rules for writing code Conditions = Statements that control the flow of a program

Match the following terms with their definitions:

Decision making logic = Process of determining the course of action based on certain conditions Client-side scripting = Scripting that runs on the user's browser General-purpose programming = Programming language designed for a wide range of applications Database queries = Requests for accessing or manipulating data in a database

Match the following PHP function types with their descriptions:

Built-in functions = Functions provided by PHP language itself User defined functions = Functions defined by the programmer

Match the following PHP function categories with their primary usage:

PHP Array Functions = Interacting with and manipulating arrays PHP Calendar Functions = Converting between different calendar formats PHP File System Functions = Accessing and manipulating the filesystem PHP MySQL Functions = Handling MySQL and controlling it through PHP functions

Match the following PHP Array Functions with their descriptions:

Array() = Creating an array Array push() = Adding one or more elements to the end of an array Array pop() = Removing the last element from an array

Match the following PHP Calendar Functions with their descriptions:

Cal info() = Returns information about a particular calendar Cal days in month() = Returns the number of days in a month for a given year and calendar

Match the following PHP File System Functions with their descriptions:

Copy() = Copies a file Delete() = Deletes a file File() = Reads entire file into an array Filetype() = Gets file type

Match the following PHP MySQL Functions with their descriptions:

mysql_close() = Closes a MySQL connection mysql_connect() = Opens a connection to a MySQL Server

Match the following math functions with their descriptions:

hexdec() = Converts a hexadecimal number to decimal sqrt() = Returns the square root of a number sin() = Returns the sine of a number

Match the following PHP function types with their descriptions:

Array Functions = Interact with and manipulate arrays Calendar Functions = Simplify converting between different calendar formats File System Functions = Access and manipulate the filesystem MySQL Functions = Dealing with MySQL handling and logging or controlling MySQL through PHP functions

Match the following PHP array functions with their descriptions:

Array() = Create an array Array push() = Add one or more elements to the end of an array Array pop() = Remove the last element from an array Array shift() = Remove the first element from an array

Match the following PHP calendar functions with their descriptions:

Cal info() = Return information about a specific calendar Cal days in month() = Return the number of days in a month for a given year and calendar

Match the following PHP file system functions with their descriptions:

Copy() = Copy a file Delete() = Delete a file File() = Read entire file into a string Filetype() = Determine file type

Test your understanding of PHP conditional statements with this quiz. Explore the importance of conditional statements, different types available in PHP, and their application in creating website logic.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

PHP Basics: Introduction and Syntax
12 questions
Web Development Lecture 9: PHP Loops and Functions
5 questions
PHP Web Development Lecture 10
5 questions
Use Quizgecko on...
Browser
Browser