Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Answers:

1. Which is the correct PHP code that will output the "hello world".

A. debug.print "hello world"; B. echo "hello world";

C. printf "hello world"; D. document.write "hello world";

2. What part of a database that holds only one type of information?

A. record B. file C. field D. report

3. Which of the following is not a data type?

A. Boolean B. integer C. string D. operator

4. "And", "or" , "not", and "xor" are examples of:

A. String Operators B. Comparison Operators

C. Logical Operators D. Assignment Operators

5. In HTML, what type of input element is more suitable to use for this: to determine if you
owned a car.

A. text B. radio C. checkbox D. button

6. Which of the following is not an html element?

A. checkbox B. table C. span D. form

7. Which of the following is used to send raw HTTP headers?

A. require() B. headers() C. include() D. header()


8. What is the code in VB to exit a for loop?

A. break B. exit C. exit for D. end

9. This PHP function breaks a string into an array.

A. implode() B. array() C. explode() D. convert()

10. This loop function repeats a block of statements while a condition is True or until a
condition becomes True.

A. With Statement B. While...Wend Statement

C. For...Next Statement D. Do...Loop Statement

****Programming will be checked by MIS


Write a code in HTML/CSS:

1. Create a table with 2 columns and 2 rows. On first row first column set as lastname and in
second set it as firstname

"<table>
<tr>
<td>lastname></td>
<td>firstname></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>"

2. Create html element that will hold user input for Gender.
"<select>
<option>Male</option>

<option>Female</option>

</select>"

3. Write the one line code to include external css file on html page.

<link rel="stylesheet" type="text/css" href="csspath">

4. Write the one line code to include external javascript file on html page.

<script type="text/javascript"src="javascriptpath"></script>

Write a code in PHP:

1. Display all even numbers between 0-99.


"for($i=0;$i<=99;$i++){
if($i % 2 ==0) echo $i;

}"

2. Create array of primary colors. (red, yellow, blue)


"$color=array('red','yellow','blue');
or
$color=array();
$color[]='red';
$color[]='yellow';
$color[]='blue';"

3. Add the secondary colors (orange,green,violet) on existing array of primary colors.


"$color[]='orange';
$color[]='green';
$color[]='violet';
or
array_push($color,'orange','green','violet');"

4. Output all values on array using loop.

"foreach($color as $x){
echo $x;
}
or
foreach($color as $x) echo $x;
}”

5. Create a function that will validate the passed argument if a valid number.
"functionchecknum($num){
if(is_numeric($num)) return true;
else return false;
}”

6. Create a class that will hold employee information: lastname,firstname, middlename,


department

class employee{
var $lastname;
var $firstname;
var $midname;
var $department;
function __construct($lname,$fname,$mname,$dept){
$this->lastname=$lname;
$this->firstname=$fname;
$this->midname=$mname;
$this->department=$dept;
}
}

or

class employee{
var $lastname;
var $firstname;
var $midname;
var $department;
function setEmp($lname,$fname,$mname,$dept){
$this->lastname=$lname;
$this->firstname=$fname;
$this->midname=$mname;
$this->department=$dept;
}
}
Reference for questions below:

Database Name: sampledb Server: localhost User: user Password: password

Table name: employee Fields:


id,lastname,firstname,middlename,birthday,age,department

7. Establish a connection to database stated above.


$conn=mysql_connect('localhost','user','password');
mysql_select_db('sampledb');
or
$conn=mysql_connect('localhost','user','password',true);
mysql_select_db('sampledb',$conn);

8. Get and display all employees lastname having age less than 25.

$result=mysql_query("select * from employee where age<25");


while($rs=msyql_fetch_array($resut){
echo $rs['lastname'];
}
or
$result=mysql_query("select * from employee where age<25",$conn);
while($rs=msyql_fetch_array($resut){
echo $rs['lastname'];
}

Write a SQL statement:

Reference for questions below:

Table 1 name: employee Fields:


id,lastname,firstname,middlename,birthday,age,department

Table 2 name: attendance Fields: id,attdate,timein,timeout

1. get all finance department in table 1 and sort lastname in ascending order.

select * from employee where department="finance" order by lastname


2. create an update query that will increment age by 1 for those employees celebrating their
birthday today.

update employee set age=age+1 where birthday="2014-11-05"


or
update employee set age=age+1 where birthday=#2014-11-05#
or
update employee set age=age+1 where birthday=#11/05/2014#

3. create a query that will link the two tables, and get the attendance of all marketing
department only.

select * from employee inner join attendance on attendance.id=employee.id where


department="marketing"

Write a code in VB:

1. Create a procedure that will return product of two passed arguments.

Public/Private Function product(num1 as integer,num2 as integer) as integer


product=num1*num2
End function

2. Declare a variable that will hold currency value.3. Create a constant variable for Pi.

dim variable as double

3. Create a constant variable for Pi.

const PI=3.14

4. Assign a value on textbox on form1, for first textbox will be your lastname, and for 2nd text
box will be your firstname.

form1.textbox1.text="semacio"
form1.textbox2.text="julian"
or
with form1
.textbox1.text="semacio"
.textbox2.text="julian"
endwith

5. Create a procedure that will validate if input is a number.

Private function checknum(num as integer) as boolean


if not isnumeric(num) checknum=false
else checknum=true
End function

6. Create a procedure that will validate if year supplied is leap year.

Private function leapyear(yr as integer) as boolean


if(yr mod 4 = 0) leapyear=true
else leapyear=false
End function

Reference for questions below:

MS Access Database Name: sampledb2 Location: C:\Database

Table 1 name: employee Fields: id,lastname,firstname,middlename,birthday,age,department

7. Establish a connection to database stated above.

dimcn as new adodb.connection


cn.connectionstring="provider=Microsoft.jet.oledb.4.0; data
source=c:\Database\sampledb2.mdb & "
cn.open

8. Get and display all employees name in HR department.


dim rs as new adodb.recordset
rs.open "select * from employee where department="hr",cn, adopenstatic, adlockoptimistic
do while not rs.eof
print rs!lastname&rs!firstname&rs!midname
rs.movenext
loop
or
dim rs as new adodb.recordset
rs.open "select * from employee where department="hr",cn, adopenstatic, adlockoptimistic
do while not rs.eof
debug.printrs!lastname&rs!firstname&rs!midname
rs.movenext
loop

You might also like