TCS Papers: Sample Questions 398 - 399 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 398

» Basic CS » Networks

Essay Question▾

Describe in Detail

Difference between router and gateway

Explanation

Difference between Router and gateway

Difference between Router and gateway

Router

Gateway

Communicates between two different networks and uses the best path to reach destination.

Outer interface of the network. All traffic from one network to another network passes through a gateway.

Layer 3 device used for inter network communication and routing purpose. Application device with ports, to which the computers and servers connect.

Entry exit point of network. Is either a server with a gateway application installed or a device that connects a network of computers to another network

Routers are programmed with routing tables to determine the shortest possible path between Computer A and Computer B.

If Network A wants to connect to Network B and vice versa, both networks must have gateways that provide exit and entry points for computers from the two networks to communicate.

Routing table contains a list of IP addresses that a router can connect to transfer data sophisticated enough to determine the number of possible “hops” from one computer to another.

Gateways are important. They define the boundaries of network.

Question number: 399

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

How to check whether a linked list is circular?

Explanation

  • Create two pointers, and set both to the start of the list. Update each as follows:

  • while (pointer1) {pointer1 = pointer1- > next; pointer2 = pointer2- > next; if (pointer2) pointer2 = pointer2- > next; if (pointer1 == pointer2) {print (“circular”); } }

  • If a list is circular, at some point pointer2 will wrap around and be either at the item just before pointer1, or the item before that. Either way, it’s either 1 or 2 jumps until they meet.