HTML Questions and Answers Part-30

1. Which scheme is used for secure HyperText Transfer Protocol?
a) ftp
b) http
c) https
d) file

Answer: c
Explanation: https scheme is for secure or encrypted web pages, http is HyperText Transfer Protocol used for common web pages which are not encrypted, ftp is file transfer protocol for downloading and uploading of documents.

2. ASCII is _____________
a) 6-bit character set
b) 7-bit character set
c) 9-bit character set
d) 3-bit character set

Answer: b
Explanation: ASCII consists 7-bit character set which has 128 characters. There are numbers 0-9, upper and lower case letters from A-Z, and also include special characters. Including modern computers, internet these characters are used in HTML also.

3. In URL encoding replaces non-ASCII characters with ________
a) “*”
b) “&”
c) “%”
d) “+”

Answer: c
Explanation: In URL encoding non-ASCII characters are replaced with “%” which is followed by hexadecimal digits. URL can only contain ASCII character set. There should be no space in the URL, space is replaced by %20 or “+” in URL encoding.

4. Which function is used in JavaScript for URL encoding?
a) encodeURI()
b) Server.URLEncode()
c) rawurlencode()
d) UREncoding

Answer: a
Explanation: There are some built in functions in JavaScript, ASP and PHP for URL encoding. JavaScript use encodeURI() function. ASP uses Server.URLEncode() function, rawurlencode() function is used by PHP. Space is encoded as %20 by JavaScript function.

5. Which of the following is not a reserved character?
a) &
b) >
c) +
d) @

Answer: b
Explanation: Reserved characters are ‘@’, ‘=’, ‘?’, ‘:’, ‘;’, ‘/’, ‘,’, ‘+’, ‘$’, ‘&’. Unsafe characters are space, ‘”’, ‘>’, ‘<’, ‘#’, ‘%’, ‘{‘, ‘}’, ‘~’, ‘^’, ‘[‘, ‘|’, ‘\’, ‘`’, ‘]’. There is a URL Encode for all of these characters. Apart from URL Encode there is Decimal and Hex value also for the characters.

6. What is the URL Encode for tab character?
a) %09
b) %08
c) %0d
d) %0a

Answer: a
Explanation: For tab character URL encode is %09, its Decimal value is 9 and Hex value is 09, %08 is URL encode for backspace, its Decimal value is 8 and Hex value is 08, %0d is URL Encode for carriage return, Decimal value is 13 and Hex value is 0d, %0a is URL encode for linefeed, Decimal value is 10 and Hex value is 0a.

7. Which of the following is not encode by encodeURI() function?
a) >
b) [
c) \
d) :

Answer: d
Explanation: encodeURI() function is JavaScript function. It encodes special characters. The characters that can’t be encoded are ‘,’, ‘?’, ‘/’, ‘@’, ‘=’, ‘&’, ‘$’, ‘+’, ‘#’, ‘:’. Its syntax is encodeURI(uri), uri is the URI that to be encoded.

8. Which of the following is used to decode the encoded URI?
a) encodeURI()
b) encodeURIComponent()
c) decodeURI()
d) Server.URLEncode()

Answer: c
Explanation: encodeURI(), encodeURIComponent, decodeURI() are the Java Script function. encodeURI(), encodeURIComponent() are the functionsthat encode URL. decodeURI() is the function that decode the encoded URL.

9. What is the URL encoding of VT?
a) %0B
b) %09
c) %06
d) %02

Answer: a
Explanation: The URL Encode for VT (vertical tab) character is %0B, %09 is for horizontal tab character, %06 is the URL Encode for ACK (acknowledge), %02 is URL Encode for STX (start of text) character. %00 is the URL Encode for NUL (null character).

10. Which is not a reserved character?
a) _
b) (
c) )
d) *

Answer: a
Explanation: There are two type of characters reserved and unreserved characters. Characters that are allowed in URL but not have any reserved purpose are unreserved characters. These are the characters from A-Z, a-z, 0-9, ‘~’, ‘_’, ‘.’, ‘-‘.