Juniper Networks
10+ Knack Global Interview Questions and Answers
Q1. Swap Adjacent Bit Pairs Problem Statement
Given an integer N
, your task is to compute the number that results from swapping each even position bit of N
's binary representation with its adjacent odd bit to the r...read more
Swap each even position bit of an integer with its adjacent odd bit to the right in binary representation.
Iterate through the binary representation of the integer and swap adjacent bits at even positions with odd positions.
Convert the modified binary representation back to an integer to get the final result.
Handle edge cases like leading zeros in binary representation.
Q2. Level Order Traversal of Binary Tree
Given a Binary Tree of integers, your task is to return the level order traversal of the tree.
Input:
The first line contains an integer 'T' which denotes the number of test...read more
Return the level order traversal of a Binary Tree of integers.
Perform a level order traversal using a queue data structure
Start by pushing the root node into the queue
Pop each node from the queue, print its value, and push its children into the queue
Components of an IP packet header
Version
Header Length
Type of Service
Total Length
Identification
Flags
Fragment Offset
Time to Live
Protocol
Header Checksum
Source IP Address
Destination IP Address
Options
The TCP segment header consists of various components that help in the transmission of data over a network.
Source Port
Destination Port
Sequence Number
Acknowledgment Number
Data Offset
Reserved
Flags
Window Size
Checksum
Urgent Pointer
Q5. how do you swap two particular bits of an integer program?
Swapping two particular bits of an integer program.
Use bitwise operators to get the values of the two bits to be swapped
Use XOR operator to swap the bits
Shift the bits back to their original positions
Example: Swapping 2nd and 5th bits of 8 (1000) gives 32 (100000)
Example code: num ^= (1 << bit1) | (1 << bit2);
TCP is connection-oriented, reliable, and slower, while UDP is connectionless, unreliable, and faster.
TCP is connection-oriented, meaning it establishes a connection before sending data, while UDP is connectionless and does not establish a connection.
TCP is reliable as it ensures all data packets are received in order and retransmits any lost packets, while UDP does not guarantee delivery or order of packets.
TCP is slower than UDP due to the overhead of error-checking, flow c...read more
Q7. IP packet header and meaning of each field and usage of each field
IP packet header fields and their usage
Version: indicates the IP version being used (IPv4 or IPv6)
Header Length: specifies the length of the IP header
Type of Service: used to prioritize packets
Total Length: specifies the total length of the IP packet
Identification: used to identify fragments of a larger packet
Flags: used to control fragmentation
Fragment Offset: used to reassemble fragmented packets
Time to Live: specifies the maximum number of hops a packet can take
Protocol: s...read more
Q8. TCP packet header and meaning of each field and usage of each field
TCP packet header fields and their usage
TCP packet header consists of 20 bytes
Fields include source and destination ports, sequence and acknowledgement numbers, flags, window size, and checksum
Source and destination ports identify the endpoints of the connection
Sequence and acknowledgement numbers are used for reliable data transfer
Flags indicate the purpose of the packet, such as SYN, ACK, FIN, RST
Window size is used for flow control
Checksum is used for error detection
Q9. why security is important in a system?
Security is important in a system to protect against unauthorized access, data breaches, and cyber attacks.
Prevents unauthorized access to sensitive data
Protects against data breaches and cyber attacks
Ensures confidentiality, integrity, and availability of data
Compliance with regulations and standards
Maintains trust and confidence of customers and stakeholders
Q10. Telephone directory implementation program
Implement a telephone directory program using an array of strings.
Create an array of strings to store the directory
Implement functions to add, delete, and search for entries
Consider using a hash table for faster search times
Include error handling for invalid input
Q11. level printing of a tree program
Printing a tree in level order
Use a queue to store nodes in level order
Enqueue root node and print its value
Dequeue the node and enqueue its children
Repeat until queue is empty
Q12. Dictionary implementation program
A program to implement a dictionary using an array of strings.
Use an array of strings to store the words and their definitions.
Implement functions to add, delete, and search for words.
Consider using a hash table for faster search times.
Q13. tcp Vs udp
TCP is a reliable, connection-oriented protocol while UDP is a faster, unreliable, connectionless protocol.
TCP ensures data delivery and error checking while UDP does not.
TCP establishes a connection before data transfer while UDP does not.
TCP is used for applications that require reliable data transfer like email, file transfer, etc. while UDP is used for applications that require speed like online gaming, video streaming, etc.
More about working at Juniper Networks
Interview Process at Knack Global
Reviews
Interviews
Salaries
Users/Month