CSC 381
CSC 381
The two operators used for the comparison of objects in PHP are:
== (Equality): Compares if two objects are instances of the same class and have the same properties
with equal values.
=== (Identity): Compares if two objects are instances of the same class, have the same properties with
equal values, and are the same instance (refer to the same object in memory).
when a webpage loads, the web browser produces a ------------ of the webpage and Javascript can access
all the elements of the webpage using ---------------
When a webpage loads, the web browser produces a Document Object Model (DOM) of the webpage,
and JavaScript can access all the elements of the webpage using the DOM API or methods like
document.getElementById, document.querySelector, etc
in HTML, the -------- indicates to the web browser how to display web pages, and --------- can provide
additional information about the HTML elements on a page
In HTML, the tags indicate to the web browser how to display web pages, and attributes can provide
additional information about the HTML elements on a page.
------ and ------- are the most proper and typical ways to begin and end a PHP block of code respectively
<?php** and **?> are the most proper and typical ways to begin and end a PHP block of code,
respectively.
PHP borrowed its syntax from two programming languages which are --------------- and --------------
PHP borrowed its syntax from two programming languages, which are C and Perl.
PHP stands for ---------------- while the PEAR in PHP stands for?
PHP stands for Hypertext Preprocessor, while PEAR in PHP stands for PHP Extension and Application
Repository.
the two main techniques to read and write a file in javascript are ----------- and -------------
The two main techniques to read and write a file in JavaScript are:
File API (for client-side operations, such as reading files in the browser using FileReader).
File System Module (fs) (for server-side operations in Node.js to read and write files).
readFile() and rs. writeFile() methods are used to read and write of a file using javascript
True
MySQL requires a semicolon after each query to indicate the end of the statement.
False
Multiple inheritance is not supported in PHP. However, PHP provides traits as a way to achieve similar
functionality.
------------- and ------------- are the fundamental categories of data types in Java script
-------------, -------------- and ------------ are the functions used to get the image's properties( width, size, and
height) in PHP?
getimagesize(), filesize(), and imagesx() are the functions used to get the image's properties (width,
size, and height) in PHP.
the keywords ---------, ------------- and ------------- are used in Javascript to handle exceptions
try, catch, and finally are the keywords used in JavaScript to handle exceptions.
the two major methods to submit form in php are -------------- and -------------
GET and POST are the two major methods to submit a form in PHP.
Javascript support the following three types of popup windows -----------, ------- and ------------
alert(), confirm(), and prompt() are the three types of popup windows supported by JavaScript.
in PHP, the two most fundamental constructs for printing to output are ------- and ------------
echo and print are the two most fundamental constructs for printing to output in PHP.
the ------------------ in Html is used to link another document on a website, and ---------- command is used
to delete the entire data in a table without disturbing the table definition in MySQL
The <a> tag in HTML is used to link another document on a website, and the TRUNCATE command is
used to delete the entire data in a table without disturbing the table definition in MySQL
SECTION B
Copy code
function scopeExample() {
console.log(globalVar); // Accessible
console.log(localVar); // Accessible
html
Copy code
<script>
console.log("Hello, world!");
</script>
html
Copy code
<script src="script.js"></script>
javascript
Copy code
function sumEvenNumbers(arr) {
return arr.filter
(num => num % 2 === 0).reduce((sum, num) => sum + num, 0); }
yaml
Copy code
---
#### Question 2
Example:
```javascript
javascript
Copy code
const obj = {
name: "John",
greet() {
console.log(this.name); // "John"
},
};
obj.greet();
javascript
Copy code
function removeVowels(str) {
}
}
Question 3
1. Function keyword.
2. Function name.
3. Parameters (optional).
php
Copy code
function greet($name) {
php
Copy code
$hour = date("H");
} else {
2. Integer: 42
3. Float: 3.14