HTML Questions & Answers – URL Encoding

This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “URL Encoding”.

1. URL is ___________
a) web address
b) source code
c) user’s address
d) an attribute
View Answer

Answer: a
Explanation: URL is the second name of a web address. It is composed of IP (Internet Protocol) address or words. Its full form is Uniform Resource Locators. Generally entering name while surfing is easy as numbers are hard to remember.

2. What is the correct syntax of web address?
a) path://prefix.port:domain/filename/scheme
b) scheme://prefix.domain:port/path/filename
c) prefix://scheme.port:domain/filename/path
d) port://domain.filenmae:path/scheme/prefix
View Answer

Answer: b
Explanation: The correct syntax for a web address is scheme://prefix.domain:port/path/filename, where scheme is for https or http, prefix is for domain like www, domain denotes domain name, port defines port number, path defines path at server, filename is for name of the document.

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

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.
advertisement
advertisement

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

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.

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

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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

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.

7. What is URL encode of ‘&’?
a) %24
b) %2c
c) %3d
d) %26
View Answer

Answer: d
Explanation: URL encoding of ‘&’ is %26, its Decimal value is 38 and the Hex value is 26. %24 is URL encode of ‘$’ whose Decimal value is 36 and Hex value is 24, %2c is URL encode of ‘,’ its Decimal value is 44 and Hex value is 2c, %3d is URL encode of ‘=’, its Decimal value is 61 and Hex value is 3d.
advertisement

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

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.

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

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.
advertisement

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

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.

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

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.

12. What is the URL Encode for the character ‘M’?
a) %47
b) %4A
c) %4D
d) %50
View Answer

Answer: c
Explanation: The URL Encode for character ‘M’ is %4D, %47 is URL Encode for ‘G’, %4A is URL Encode for ‘J’, %50 is URL Encode for the character ‘P’. The URL Encode for A to Z characters start from 41 to 5A followed by a ‘%’ sign serially.

13. Which of the following is not control character?
a) BS
b) NUL
c) ampersand
d) HT
View Answer

Answer: c
Explanation: ASCII control characters are defined from %00-%1F, these characters are to design control hardware devices. These characters are not used inside URL. NUL, ENQ, ETX, BEL, BS, HT, LF, EOT, CR, DLE, DC3 are some of the control characters. BS is for backspace, NUL is for null character, HT is for the horizontal tab character.

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

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).

15. Which is not a reserved character?
a) _
b) (
c) )
d) *
View Answer

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, ‘~’, ‘_’, ‘.’, ‘-‘.

Sanfoundry Global Education & Learning Series – HTML.

To practice all areas of HTML, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.