This set of PHP Multiple Choice Questions & Answers (MCQs) focuses on “Networking with PHP”.
1. What is the full form of DNS?
a) Digital Network System
b) Domain Network System
c) Digital Name Systmem
d) Domain Name System
View Answer
Explanation: DNS stands for domain name system. It is the way that internet domain names are located and translated into internet protocol (IP) addresses. For example, if someone types abc.com into the web browser, a server behind the scenes will map that name to the IP address 206.16.49.139.
2. Which one of the following function checks for the existence of DNS records?
a) checkdns()
b) checkdnsr()
c) checkdnsrr()
d) checkdnsa()
View Answer
Explanation: The function checkdnsrr() is used to check DNS records for type corresponding to host. DNS records are checked based on the supplied host value and optional DNS resource record type, returning TRUE if any records are located and FALSE otherwise.
3. Which one of the following function is used to return an array consisting of various DNS resource records pertinent to a specific domain?
a) dns_get_record()
b) dns_record()
c) dnsrr_get_record()
d) dnsrr_record()
View Answer
Explanation: The function dns_get_record() is used to get the DNS resource records associated with the specified hostname. This function is used to return an array consisting of various DNS resource records pertinent to a specific domain.
4. Which one of the following function is used to retrieve the MX records for the domain specified by hostname?
a) getmx()
b) retrieve_mx()
c) getmxrr()
d) retrieve_mxrr()
View Answer
Explanation: The function getmxrr() returns the MX records for the specified internet host name. This function is used to retrieve the MX records for the domain specified by hostname.
5. What is the default port number of HTTPs?
a) 70
b) 80
c) 90
d) 100
View Answer
Explanation: By default, The port number HTTP uses is port 80 and HTTPS uses port 443, but a URL like http://www.abc.com:8080/path/ specifies that the web browser connects instead to port 8080 of the HTTP servers.
6. Which one of the following function returns the port number of a specified service?
a) getportname()
b) getservername()
c) getserverbyname()
d) getservbyname()
View Answer
Explanation: The function fgetservbyname() returns the port number for a given Internet service and protocol. Example-getservbyname(“http”,”tcp”) will return 80.
7. Which one of the following statements can be used to establish port 80 connection with www.nachi.com?
a) fsockopen(“www.nachi.com”, 80);
b) sockopen(80,”www.nachi.com”);
c) fsockopen(80,”www.nachi.com”);
d) sockopen(“www.nachi.com”, 80);
View Answer
Explanation: The fsockopen() function establishes a connection to the resource designated by target on port.
8. Which one of the following function is used to send an email using PHP script?
a) mail_send()
b) send_mail()
c) mailrr()
d) mail()
View Answer
Explanation: The function mail() allows you to send emails directly from a script. Using mail(string to, string subject, string message), you can send any mail.
9. How many configuration directives pertinent to PHP’s mail function are available?
a) 4
b) 5
c) 6
d) 7
View Answer
Explanation: They are- SMTP, sendmail_from, sendmail_path, smtp_port, mail.force_extra_parameters.
10. Which of the following statements is used to add an attachment to the mail?
a) $mimemail->attachment(‘attachment.pdf’);
b) $mimemail=>attachment(‘attachment.pdf’);
c) $mimemail->addAttachment(‘attachment.pdf’);
d) $mimemail=>addAttachment(‘attachment.pdf’);
View Answer
Explanation: Call the Mail_Mime object’s addAttachment() method passing in the attachment name and extension.
Sanfoundry Global Education & Learning Series – PHP Programming.
To practice all questions on PHP Programming, here is complete set of 1000+ Multiple Choice Questions and Answers on PHP.
- Apply for Programming Internship
- Practice Programming MCQs
- Practice MCA MCQs
- Check MCA Books
- Check Information Technology Books