WorksheetsObject-oriented programming final exam
Total questions: 50
Worksheet time: 27mins
What does OOP stands for?
Out of place
Objective Oriented Programming
Object Oriented Programming
Objects Orienting Program
A class is a(n):
Instance of an object
Blueprint for creating objects
Data type
Function
An object is a(n):
Instance of a class
Blueprint for creating classes
Data type
Function
Properties are:
Actions that an object can perform
Characteristics of an object
Data types
Functions
Methods are:
Actions that an object can perform
Characteristics of an object
Data types
Functions
A constructor is:
A special method that initializes an object
A method that returns a value
A property of a class
A data type
When is a constructor called?
When a class is defined
When a class is referenced
When an object of the class is created
When a method of the class is called
Inheritance is:
The concept of creating objects
The process of creating a new class from an existing class
The ability of a class to inherit properties and methods from another class
The process of defining a class
What is the base class in inheritance?
The class that inherits properties and methods
The class from which properties and methods are inherited
The class that is created
The class that is destroyed
Abstraction is
The process of defining a class
The concept of inheritance
The process of creating objects
The process of hiding unnecessary details
Which of the following is an example of abstraction?
A car's driver
A car's engine
A car's steering wheel
A car's navigation system
Encapsulation is
The process of hiding data and methods within a class
The concept of inheritance
The process of creating objects
The process of defining a class
Why is encapsulation important?
It makes code more readable
It makes code more maintainable
It makes code more secure
All of the choices
An object is created using the keyword:
object
new
class
create
Which access modifier allows a member to be accessed only within its own class?
public
private
protected
D. internal
Which access modifier allows a member to be accessed by any class within the same assembly?
public
private
protected
internal
Which access modifier allows a member to be accessed anywhere in the project?
public
private
protected
internal
When are parameters defined?
When a method is called
When a method is declared
When a variable is declared
When a data type is defined
When are arguments passed?
When a method is declared
When a method is called
When a variable is declared
When a data type is defined
5 % 17 = ?
5
17
2
3
What type of language is PHP
Client Side
Server Side
Browser Side
Web Side
PHP is executed on
The Server
The Browser
The Website
The Machine
We store small snippets of information inside what?
Functions
Loops
If Statements
Variables
We create re-usable code blocks by placing them inside?
Variables
Parameters
Code Blocks
Functions
Sometimes we only want certain code to execute if a condition is true. How do we test for that?
Loop
If Statement
Integer
Variable
$colours = array("black, blue, Red, Green") - How do I access "Red" ?
$colours[0];
$colours[2];
$colours[1]
$colours[3];
How do I print out the values of the variable "name" ?
$name;
include $name;
echo $name;
echo $name
function sayMyName(name) {} ; - How do I call tat function
sayMyname();
$sayMyName;
$sayMyName();
sayMyName("John")';
What type of variable is this: $isMale = false;
Integer
Boolean
String
char
$a = 4 ; $b = 6; $c = $a + $b; What is the value of variable "c" ?
6
8
10
None
Which tag is used for php
<?php
?>
<style>
<php ?>
<php
/php>
<?php
function add()
{
global $a=10;
echo $a;
}
add();
$a+=10;
?>
Output is
10
15
20
30
Which of the following is NOT a valid way to start a PHP code block?
<?php
<?=
<!--
<?
Create a variable in php assign with the
String
const
let
$
Write a correct syntax to include a file named "footer.php".
include ("footer.php");
import("footer.php");
required("footer.php");
export("footer.php");
PHP stands for
Hypertext processor
Homepage processor
Hypertext preprocessor
_______ is a concatenation operator in php
+ (plus)
+=
. (dot)
PHP is a case sensitive
TRUE
FALSE
PHP is a ............
Open Source Language
Widely Used Language
Server side scripting language
All of the above
Which of the following symbol is used to add multiple line comments in PHP ?
//
/* */
{{ }}
{/ \}
Which of the below symbols is a newline character?
<br>
\n
/n
\r
The 2 basic ways to get output in PHP are __________.
echo and cout
echo and scan
echo and print
The default file extension for PHP files is __________.
.html
.php
.css
.java
Where is your PHP project file located?
C:\xampp\htdocs\
C:\xampp\project\
D:\xampp\htdocs\
PHP Scripts are executed using
XAMPP
JAVA
EDITOR
NONE
Choose the equivalent of the statement : $sub -= $sub.
$sub = $sub - 1
$sub = $sub - $sub
$sub = $sub - $sub -1
$sub = - $sub
HTML
page can be access using _______ protocol.
HTTP
FTP
SMTP
POP
Why
should we use functions?
Reusability
Easier
error detection
Easily
maintained
All of
the above
Which of the following is not a component of CRUD?
Create
Read
Update
Drop
