wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

HTML PHP C++

Total questions: 10

Worksheet time: 50mins

Name
Class
Date
1.

In HTML, Set the max numbers of characters allowed in the input field to 40.

a)

<input type="text" maxlength="40" >

b)

<input type="40" maxlength="text" >

c)

<input type="text" "maxlength"="40" >

d)

<input type="text" maxlength="" >

2.

Use the correct HTML attribute to make the link open in a new window.

a)

<a href="html_images.asp" target="_blank" >HTML Images</a>

b)

<a href="html_images.asp" target="blank" >HTML Images</a>

c)

<br href="html_images.asp" target="_blank" >HTML Images</br>

d)

<a link="html_images.asp" target="_blank" >HTML Images</a>

3.

In the HTML form below, add two option elements to the drop down list.

The first option must have the value "Proton" The second option must have the value "Perodua".

a)

<radio value="Proton">Proton</>

<radio value="Perodua">Perodua</>

b)

<select value="Proton">Proton</>

<select value="Perodua">Perodua</>

c)

<option value="Proton">Proton</>

<option value="Perodua">Perodua</>

d)

<name value="Proton">Proton</>

<option name="Perodua">Perodua</>

4.

Get the length of the string "Hello World!" in PHP.

a)

echo ("Hello World!");

b)

echo strlen("Hello World!");

c)

echo strrev("Hello World!");

d)

echo str_replace("Hello World!");

5.

Use the correct comparison operator in PHP to check if $a is NOT equal to $b.

a)

var_num($a != $b);

b)

var_num($a == $b);

c)

var_num($a x= $b);

d)

var_num($a = $b);

6.

Create a loop in PHP that runs from 0 to 9.

a)

do ($i = 1; $i < 10; $i++) { echo $i; }

b)

for ($i = 1; $i < 10; $i++) { echo $i; }

c)

for ($i = 0; $i < 9; $i++) { echo $i; }

d)

for ($i = 0; $i < 10; $i++) { echo $i; }

7.

Use the correct keyword in C++ to get user input, stored in the variable y:

a)

int x; cout << "Type a num: "; cin>> x;

b)

int y; cout << "Type a num: "; cin>> y;

c)

int y; cin<< "Type a num: "; cout>> y;

d)

int x; cin<< "Type a num: "; cout>> x;

8.

Print "Yes" if x is equal to y, otherwise print "No" in C++.

a)

if (x==y){cout<<"No" ;}

else

{cout<<"Yes" ;}

b)

if (x==y){cout<<"Yes" ;}

else

{cout<<"No" ;}

c)

if (x!=y){cout<<"Yes" ;}

else

{cout<<"No" ;}

d)

if (x==y){cin<<"Yes" ;}

else

{cin<<"No" ;}

9.

Insert the missing part to print the number in main, by using a specific keyword inside myfunc in C++

a)

int myfunc (int x) { cout 5 + x; }

b)

int myfunc (int x) { cin 5 + x; }

c)

int myfunc (int x) { return 5 + x; }

d)

int myfunc (int x) { main 5 + x; }

10.

Use access specifiers to set the x variable to public and y to private in C++

a)

class MyClass { public:

int x;

private:

int y; };

b)

class MyClass { public:

int y;

private:

int x; };

c)

class MyClass { private:

int x;

private:

int y; };

d)

class MyClass { public:

int y;

public:

int x; };