Ruby Logo

Ruby Networking Quiz

Test your understanding of Ruby networking concepts including HTTP clients, sockets, TCP/UDP, and URI handling.

Home Ruby Ruby Networking Quiz

Ruby Networking Quiz

Question 1: Net::HTTP Basics

Which method would you use to make a simple GET request to 'https://api.example.com/users' using Net::HTTP?

Question 2: TCP vs UDP

What is the main difference between TCP and UDP protocols?

Question 3: TCPServer

What does the following code do?

server = TCPServer.new('localhost', 3000)
client = server.accept

Question 4: URI Parsing

Given the URL 'https://api.example.com:8080/v1/users?active=true#section1', what would URI.parse(url).port return?

Question 5: open-uri

Which is the correct way to open a URL with custom headers using open-uri?

Question 6: UDPSocket

What happens when you call send on a UDPSocket?

Question 7: Query Parameters

How do you properly encode query parameters containing special characters for a URL?

Question 8: Error Handling

Which exception should you catch when handling HTTP errors with open-uri?

Question 9: Socket Programming

What is the purpose of calling bind on a socket?

Question 10: Web Scraping Best Practices

Which of the following is NOT a best practice for web scraping?

Quick Navigation

Related Topics

Video Tutorial

Watch and learn ruby networking quiz

Pro Tip: After reading through the content above, watch this video to reinforce your understanding and see the concepts in action!