Wednesday, December 27, 2017

Data structures - 1

This is an old one which was lying into my pile of drafts...Seems still valuable. Thought of discussing about data structure and touch upon key points of interest,,

1. When should we use BFS and DFS .. what is the data  structure used in BFS and DFS.
2. Which technique is used by quick sort
3. How do we analyze the complexity  of algorithms
4. Which procedure uses more memory - iteration or recursion
5. How is time complexity measured. Explain with example.
6. How is space complexity measured ?
7. Which data structure is used for evaluation of expressions ?
8. What is the maximum number of nodes in a binary tree at level 5 ?
9. What is the basic concept behind bubble sort ?
10. What is the difference  between B tree and B+ tree.
11. What is the difference between full binary tree and complete tree
12. What is trinode restructuring and when is it used
13. What are the use cases of heap data structure
14. What is the time complexity in case elements  are already sorted in case of quick sort
15. What is the time complexity of search in hashing
16. In which scenario will you use in-order traversal
17. What is use of avl tree
18. What are the different types of hashing
19. How will you reduce collision in hashing
20. What is the  concept behind priority queue.
21. What is heap property ?
22. What are the types of heap and where are they used
23. In which end will element be added in case of queue and in case of stack
24. From which end the element will be deleted in case of queue and in case of stack
25. Explain selection sort
26. What is the maximum height of an avl tree with 7 nodes
27. Tower of hanoi is based on which data structure
28. The maximum number of nodes in a binary tree of height h is
29. What is input-restricted deque
30. What is Dijkstra algorithm. Where is it used
31. What is vertex, edge in graph. What id the use of adjacency matrix
32. What is directed graph and undirected graph. Share an example usecase for them
33. How  do you determine the number of edges
34. What is height balancing property
35. What is binary search tree and where is it used
36. What is 2,4 tree
37. How do you resolve underflow scenario in case of deletion in 2,4 tree
38. What is the time consumed in restructuring in avl tree
39. What is the time complexity for search, insert, delete in avl tree with and without restructuring
40. What is m-way search tree . How many keys will be stored in d node
41. What is topological sort.
42. What is a spanning tree. What is a minimum spanning tree..
43. What is heap sort and where is it used
44. What is difference between mege sort and heap sort
45. Consider a ticket reservation system. What kind of data structures shall be used for various use cases.
46. Which sorting algo shall give better results in case the input is already sorted partially
47. What is prim-jarniks algorithm. When is it used ?
48. What is the difference between kruskals algorithm and prims algorithm
49. What is the use of priority queue in prims algo and in kruskals algo. Can it be avoided
50. What is the stop criteria in kruskals algorithm.
51. What is safe edge in spanning tree algos ?
52. What is called depth of a tree, height of a tree, level in tree ?
53. What are the real life application of graph
54. What is bellman ford algorithm and difference with dijkstra algo
55. What is edge relaxation and where is it used
56. What is collision resolution by chaining
57. What is a hash table. When is hash table used.
58. What is direct addressing scheme.
59. What is hash function. Explain any hash function
60. What is division method and mad method in hashing.
61. What is separate chaining and open addressing. When are the used.
62. What is probing and basic types of probing.
63. What is the disadvantage of linear probing
64. How can stack be used for implementing queue
65. What is greedy algorithm. Give example and illustrate use  cases.
66. What is the difference between avl tree and red black tree
67. What rules / property applicable for red black tree
68. What is a skewed binary tree . What shall result in such a tree
69. What is black height of a red black tree
70. What is segment tree and where is it used
71. Which has better time complexity among sorting algos selection, merge, quick and heap sort algorithms for worst case.
72. Why is heap sort considered as unstable sort
73. Which sorting algo gives worse performance in case elements are already sorted. Why.
74. What is introsort ?
75. Give an example for non-comparison based sort.
76. What is the property of BST
77. What is AVL rotation and what are the types of it. Explain any one with an example.
78. What are the general properties for a spanning tree
79. Can a graph have more than one spanning tree
80. What are asymptotic notations
81. What is the difference between linear search and binary search
82. What is the difference between insertion sort and selection sort
83. All BSTs are binary trees. All binary trees are BSTs. Which of these statements is true.
84. Which sorting algorithms follow divide and conquer strategy
85. What is double hashing and when is it used
86. What is the time complexity of DFS algo
87. What is an adaptive sorting algorithm. Give an example.
87. How to construct a tree from a given in-order and pre-order traversal. Explain with your own example.
88. In preorder traversal, which location of output represents the root of the tree
89. List pros, cons of BST vs hash table
90. What techniques can be used to determine cycle or loop in linked list. Which is efficient
91. What techniques can be used for finding the middle of linked list.
92. How will you convert a BST to min-heap
93. What is the difference between Floyd-warshall algorithm and Dijkstra algorithm
94. What is Ford Fulkerson algorithm. Where is it used.
95. What is the difference between fulkerson algorithm and push relabel algorithm
96. What is trie data structure and where is it used




Saturday, April 23, 2016

STP

Hello everyone... Got some time to arrive on few interesting points that can be discussed regarding STP.

1. What is STP protocol ?
It is a protocol that helps in preventing loops in layer 2 and broadcast storms when we have a redundant link. It operates by blocking the redundant paths and normally provides only only one way of communication channel.

2. Is STP layer 3 or layer 2 protocol ?
It is a layer 2 protocol

3. What are the problems due to redundant layer 2 topology ?
i) Broadcast storms
ii) Multiple frame copies
iii) Unstable MAC table

4. What problems does a broadcast storm cause ?
It shall slow down the network and also reduce or block the throughput of the network

5. What is BPDU ?
The BPDU is used by switch for spanning tree algorithm to shutdown the redundant links. The STP protocol operates by exchanging small packets called as BPDU(Bridge Protocol Data Unit) which is exchanged every 2 seconds . BPDU is composed of root Id, root path cost, bridge Id, maximum age and hello timer. The root path cost is based on BW link speed. Bridge Id is based on bridge priority & bridge mac address, max age to intimate the change in root, hello timer (2 seconds). The BPDU uses multicast destination mac address(01:80:c2:00:00:00) as destination mac address.

6. What are the main steps in STP ?
Election of root bridge. Identification of root ports. Identification of designated ports. Moving a port to blocked state in case of existence of loop or activation of port that is in blocked state if the loop is removed.

7. Will there be multiple blocked ports in case of STP ?
If there exists multiple loops , then multiple ports shall be placed in blocking state.

8. How does a switch in a network is selected as root bridge ?
The root bridge is the switch with the lowest bridge identifier (Bridge ID) where the bridge identifier is based on Bridge priority & Mac address.

9. How to determine the root port ?
Once the root bridge is selected, all the switches in network will determine the shortest path to the root bridge based on root path cost. The link or interface(shorted path) that leads to the root bridge is determined as the root port. So, a root bridge cannot have a root port. Whereas, each switch shall have only one root port that always forwards traffic to the root bridge.

10. What are the types of BPDU ?
i) Configuration BPDU
ii) Topology Change Notification BPDU
iii) Topology Change Notification Acknowledgement BPDU

11. How to determine designated port ?
All ports on root bridge are termed as designated port. Normally , once the root port selection is done, the other side of the port of the link is made as the designated port. The designated port shall be in forwarding state.

12. How to determine blocked port ?
Once the link with shortest path cost is termed root port, the other link that leads to the root bridge is blocked . Blocked port(Non-designated port) shall receive information from designated port, but shall not forward the information through it. If one end of every link is designated port , the other end may be termed as either blocked port or root port.

13. How to decide root port in case of ties ?
The tie breaking is achieved based on the root path costs. In case the root path costs are same, then the bridge with the lowest switch id (bridge id based on switch priority & MAC address) is selected.

14. How to decide designated port in case of ties ?
If bridge Ids are equal, then the one with the lowest MAC address is termed as designated port.

15. What are the stages or time taken taken while change in topology ?
20 seconds(max_age) to determine change in topology. 15 seconds in listening stage where it tries to determine the root bridge, designated and blocking ports. 15 seconds in listening stage where it shall learn the mac address from user frames. Following this, it shall be in forwarding state.

16. How is root bridge elected ?
Initially all switch claim themselves as root bridge and start sending BPDUs that are used for exchange of STP information between switches. However, comparison between received BPDU information and that of locally stored information is done. The bridge with lowest bridge ID is selected as root bridge which is achieved by first comparing the priority and later by comparing the MAC addresses. Once the root bridge is selected, it shall trigger topology change and send the configuration messages with its own bridge identifier as root identifier.

17. What are the states in STP ?
Blocking, Listening, Learning, Forwarding and Disabled

18. What happens in Listening state ?
This is the state during which frame forwarding and MAC address learning are disabled. This state is obtained after moving out of blocking state whereby it receives and accepts BPDUs or sends BPDUs. The switch processes the BPDUs and awaits for new information that can cause change of state.

19. What happens in forwarding state ?
In forwarding state, the port shall send or receive data , BPDUs. But also, keeps monitoring the BPDUs for making of possible change in state.

20. What happens in learning state ?
This is the state during which the frame forwarding continues to be disabled. However, it starts MAC learning where the port starts adding entries in MAC address table by looking at the source address of incoming frames.

21. What is configuration BPDU ?
The root bridge sends configuration BPDU at every hello time with information required for calculating spanning tree topology.

22. What is topology change  BPDU ?
Bridges that detect topology change shall send this BPDU towards the root bridge which inturn shall forward to other switches to inform that a topology change has occurred in current topology.  The switches that receive the topology change BPDU (TC flag set), shall reduce the age out timer to age out filtering database entries rapidly.

Tuesday, April 12, 2016

IPv6


Lets discuss regarding IPv6. Feel free to post your queries or answers..

1. What is IPv6 ?
    It is the protocol with capabilities to replace/upgrade IPv4.

2. Difference between IPv6 and IPv4 addresses ?
    a. IPv4 uses decimal number as numbering format for ip address
        IPv6 uses hexadecimal number as numbering format for ip address
    b. IPv4 is 32-bit numeric address
        IPv6 is 128-bit address in hexadecimal
    c. IPv4 uses class-based addressing
        IPv6 uses classless addressing

3. What is the need for IPv6 ?
     a. Limitation in address space offered by IPv4
     b. Absence of security features on its own in IPv4
     c. Limitation in data prioritization / QoS offered by IPv4

4.How will you port an application from IPv4 to IPv6 ?
   The system calls should be updated with appropriate arguments as per IPv6.

5. How will you represent an IPv6 address ?
    It shall be represented as 8 groups of 4 hexadecimal digits separated by colons.

6. How could the IPv4 address exhaustion could be handled ?
    There are various approaches like Subnetting/CIDR, NAT/PAT, Use of Private networks & DHCP

7. What changes are made in header for IPv6 ?
    All unnecessary information and options that are present in IPv4 are moved to the end of IPv6 header

8. What is the size of IPv6 header ?
     IPv6 header has a fixed header size of 40 bytes, whereas the IPv4 header has a variable length due to options field.

9. Which fields are same in IPv4 and IPv6 ?
    Version field, Type of Service (IPv4) is similar as Traffic Class(IPv6), Total
    length(IPv4) is somewhat similar as Payload length(IPv6), TTL (IPv4) is same as Hop
    Limit(IPv6), Protocol(IPv4) is somewhat similar as Next Header(IPv6)

10.What is the additional field in IPv6 that is absent in IPv4 ?
     Flow label for sequencing of packets

11. Which fields have been eliminated/deleted in IPv6 from that of IPv4 ?
      Header checksum, Header length & Fragmentation fields are eliminated. The Options field is moved into payload

12. What are the new features with IPv6 ?
      a. Stateless auto configuration
             i) No need for DHCP
            ii) New host can assign its own host address
      b. New IP security protocols
             i) Authentication of source
           iii) Encryption of payload
      c. Jumbo payload option that can carry packet upto 4GB

13. What ways IPv6 devices can be deployed ?
      a. By Tunneling IPv6 over IPv4
      b. Using Dual stack router that supports both IPv4 and IPv6
      c. Using a NAT device for translation between IPv4 and IPv6

Monday, November 24, 2014

GTP

Hey everyone, here is the list of possible GTP protocol questions that can be discussed.

1. What is GTP ?
2. Why is GTP used ?
3. What is the equivalent of GTP protocol that can be used in roaming architecture in LTE ?
4. Is GTP over TCP or UDP ? Which is the preferred transport protocol for GTP ?
5. What are the variants of GTP ?
6. Which is the latest version of GTP-C and GTP-U ?
7. What is the use of GTP-C, GTP-U and GTP' ?
8. Which version introduced replaced TID with TEID ?
9. What is a TEID made of ?
10. What is the content of user payload of GTP ?
11. How is a tunnel identified in GTP-U ?
12. What is the use of GTP-U tunnel ?
13. How do the entities know the destination TEID for communication ?
14. What is a T-PDU ?
15. What is a G-PDU ?
16. What do you call the inner IP packet as ?
17. What will happen if the resultant outer IP packet is larger than the MTU of the first link towards the destination of GTPv1-U endpoint ?
18. Will the hopcount / TTL be changed by the tunnel endpoint ? Will any other entity perform it in LTE ?
19. What is the relation between fragmentation and bandwidth ?
20. Which interfaces are GTP based in LTE ?
21. What is the other protocol that can be used instead of GTP in LTE ?
22. What is the main responsibility of GTP-C ?
23. How many GTP-U tunnels can be established for a single user ?
24. How are GTP-U tunnels mapped in LTE ?
25. What is a tunnel endpoint made of ?
26. How many TEID-C can be there for a PDN connection ?
26. Is TEID unidirectional or bi-directional ?27. Does GTPv2 provide fallback to GTPv1 and GTPv0 ?
28. Why is GTPv0 not promoted ?
29. Which message shares TEID of MME to SGW and vice versa?
30. Which message shares TEID of SGW to PGW and vice versa?

Wednesday, October 15, 2014

SCTP

Here are few possible discussion questions related to SCTP protocol

1. What are the advantages of SCTP over TCP ?
2. What is multi-srtreaming in SCTP ?
3. What is multi-homing in SCTP ?
4. How is SCTP more secure than TCP ?
5. What is the use of V-Tag in SCTP ?
6. Is there any difference between the SACK of TCP and SACK of SCTP ?
7. Can SCTP allow transfer of un-ordered packets ?
8. How do you send large packets over SCTP ?
9. Who takes care of fragmentation at the sender side of SCTP and Who takes care of re-assembly at the receiver side of SCTP ?
10. What is an association ? How is it created ? To what functionality of TCP is it equivalent to ?
11. Where is SCTP used widely as of now ?
12. Can a packet packet carry only the control chunk ? Name few singleton chunks ?
13. How many data chunks can be part of a packet ?
14. What is the relation between TSN, SN and SI ?
15. What are the two random values that are generated during the setup of association ?
16. When are the ip addresses of endpoints exchanged ?
17. What is an endpoint ?
18. Is a stream in SCTP uni-directional or bi-directional ?
19. Can an association have more streams in one direction than in other direction ? That is, can inbound streams be greater than outbound streams ?
20. Can the stream number start randomly ?
21. When are the valid stream number range set ?
22. What will the receiver do if the messages are out of order in a stream ?
23. What will the receiver do if fragmented message is received ?
24. Which field plays a key role in detection of lost data chunks ?
25. When a SCTP packet arrives at the receiver, is it possible to process the data chunks before control chunks ?
26. What is the use of U B E bits (Chunk flags) ?
27. Is it possible for a single chunk to have both B and E bit set  ? What does it refer to ?
28. How is the receiver window size conveyed to the sender ?
29. What is the use of cookie and cookie-echo ? What are the contents of cookie ? How is stale cookie identified ?
30. What is SYN flood ? How is it avoided in SCTP ?
31. What is the equivalent of TCP FIN in SCTP ? Is shutdown procedure of 2-way or 3-way or 4-way handshake in SCTP ?
32. What is Head-of-line blocking and how unnecessary Head-of-line blocking are avoided in SCTP ?
33. Can a INIT-ACK chunk have the other NIC interface address rather than that of the main address ?
34. How to determine the number of duplicate TSN report ?
35. What does the field 'Number of Fragments' refer to in SACK ?
36. How is SCTP a mix of UDP and TCP features ?
37. What is the boundary alignment for chunks ?
38. Will the length field include the padding bytes also ? Will the CRC cover the entire SCTP packet (that is, will it cover the SCTP common header + chunks) ?
39. Can a control chunk or data chunk go along with INIT or INIT-ACK chunk ? Can a control chunk or data chunk go along with COOKIE or COOKIE-ECHO chunks ?
40. What are the types of sockets w.r.t SCTP ?
41. What is the relation between initiation tag and verification tag ?
42. Can an SCTP endpoint have more than 1 IP addresses and more than 1 port numbers ?
43. How many associations can be had between any two endpoints ?
44. Do un-ordered messages within a stream have SSN ?
45. What is the encoding format of chunks ?
46. Which chunk conveys the inbound and outbound streams ?
47. How to identify unrecognized chunks ?
48. What is the equivalent of TCP RST in SCTP ?
49. What are the fields/contents of SCTP common header ?
50. What is the use of Heartbeat chunk ?

Monday, October 13, 2014

Multithreading

Hi,

Here are few possible queries that can be discussed about multithreaded programming in linux !

1. Can a child process be called as a thread ?
2. Are there multiple ways to create a thread ?
3. Is it possible for the thread to be alive if we terminate the process ? Is it possible for a child process to be alive if we terminate the parent process ? 
4. What is the memory layout of a process ?
5. What is the difference between multithreading and multiprocessing ?
6. What is the memory layout of a process with 2 threads ? What is the memory layout a process with 2 child process ?
7. If we declare a variable in the thread handler of 1st thread, will it be accessible accessible to 2nd thread ?
8. If we declare one variable locally in process and another globally in process, which one will be accessible to its threads ? Will those variable be available in child process also ?
9. Is it better to design a multi-threaded application or multi-process application ?
10. When should we need to go for multi-thread design and when should we go for a multi-process design ?
11. What is TLS ?
12. Who schedules the processes and who schedules the threads ?
13. Why process considered to be heavy weight ?
14. What are the contents of PCB ? What are the contents of TCB ?
15. How to ensure that thread1 gets terminated before thread2 ?
16. What will happen if we do not reap the zombie process ?
17. What is the use of zombie process ?
18. What are the various ways to terminate a zombie process ?
19. What is the difference between wait() and waitpid() system calls ?
20. Can two zombie process communicate with each other ?
21. How do you decide on the granularity of the lock ?
22. Is it good to have big lock or small lock ?
23. What will happen if a resource is improperly locked ?
24. What is atomicity ?
25. Where are atomic operations useful ?
26. What is spinlock ?
27. What is the use of PID ?
28. What is a process, thread ? What are the differences between process and thread?
29. If there are 2 sequential fork() calls, how many child process will be there ?
30. What is the use of reentrant function in multi-threaded environment ?
31. What is the advantage of using pthreads or POSIX threads ?
32. What are the various thread models and tell the scenario in which the particular thread model is useful / beneficial ?
33. What are the advantages & dis-advantages of 1:N user level threading (thread model)?
34. What is the difference between userspace threads and kernel space threads ?
35. Will a crash of a thread impact the other thread of the process ?
36. What is the difference between pthread_create() and fork() ?
37. What information is shared between a child process and the parent process ?
38. If a parent has 2 threads , will the child process also inherit or have a copy of those 2 threads ?
39. Why a faulty pointer does not crash a process but that of a thread can corrupt the process / other threads of the process ?
40. What is co-operative multitasking and what is pre-emptive multitasking ?
41. How do avoid race conditions in multi-threading
42. What will happen if you call a sleep() in a process or thread ?
43. Will a parent process be given higher priority compared to child process by the linux scheduler ?
44. What is vfork ?
45. What is the common mode of communication between a parent process and child process ? What are the modes of communication between threads ?
46.  Is child process light weight compared to parent process ?
47. What does a fork() call return ?
48. How to terminate a process by programming method ?
49. What are the software models for mulithreaded programming ?
50. What steps are performed during a context switch of a thread and what steps are performed during a context switch of a process ?

Networking - I

Let me share few networking related queries that can be used for our discussion ...

1. What is the use of Ethernet ?
Ethernet is a link layer protocol in TCP/IP stack and the most widely used LAN technology that provides a framework for data transmission to other devices on the same network segment.

2. How is the destination MAC address obtained ?
Destination MAC address is fetched via  ARP

3. Why is TCP called as connection oriented protocol ?
As the communication session is established by means of 3 way handshake ahead of transferring data, it is termed as connection oriented protocol. Here the client initiates the creation of logical pipes through which the messages shall be sent or received. These pipes shall be deleted at the end of connection.

4. Why is UDP called as connection less protocol ?
As the communication session is not established ahead of transferring data, it is termed as connection less protocol.

5. Why is TCP termed as Heavy weight protocol ?
TCP is heavy weight because it performs handshake for connection establishment, ordering of packets, handling reliability & congestion control. That is, TCP does lots of processing to provide reliable service and hence termed as heavy weight protocol.

6. What applications use TCP ?
SSH, HTTP, FTP, Telnet, SMTP, IMAP/POP, NFS

7. What applications use UDP ?
Tunneling/VPN, TFTP, SNMP, Media streaming, Games, local broadcast , RTP

8. Why are realtime applications using UDP even though it is unreliable ?
It is used in realtime applications where it is ok even if data is lost

9. Explain any error detection mechanism in TCP ?
Error detection is viable through sequence numbers. Duplicate packets are discarded based on SN at receiver. The lost packets are re-transmitted based on ACKs.

10. What is flow control in TCP ?
In order for the receiver and transmitter to be sync on the rate of data transmission, TCP uses sliding window protocol, where the receiver intimates the sender about the amount of data that it is willing to buffer for the connection via the receive window field. The sender can accordingly send data only up to the extent.

11. What is the use of MSS in TCP ?
It is used to represent the largest amount of data that the receiver shall receive in a single segment.   

12. What is sliding window algorithm ?
TCP uses sliding window protocol, where the receiver intimates the sender about the amount of data that it is willing to buffer for the connection via the receive window field. The sender can accordingly send data only up to the extent.
       
13. Bandwidth utilization is good in TCP or UDP ?
TCP

14. Why is connect system call invoked by client ?
Connect system call helps in connecting the socket to the address of the server thereby enabling the establishment of connection.

15. Why is bind system call optional for either UDP or TCP client ?
connect system call is optional for UDP client as UDP is a connectionless protocol.

16. What is socket ?
 Socket represents an endpoint of a connection.

17. What is a raw socket and when will we use it ?
Raw socket receives or sends raw datagram without including any link layer headers. That is, it allows direct sending and receiving of internet protocol packets without any protocol specific transport layer formatting.

18. Once the segments arrive on the receiver, who does the re-assembly in the case of TCP protocol ?
IP layer handles the re-assembly.

19. Is fragmentation applicable for UDP. If yes, who does the fragmentation ?
No.

20. Is fragmentation applicable for TCP. If yes, who does the fragmentation ?
Yes. The IP layer does the fragmentation.

21. What is the need for fragmentation in TCP ?
Fragmentation is done according the MTU of the device so that the data can be transmitted.

22. What determines the size for fragmentation in TCP ?
MTU determines the size for fragmentation.

23. What is the use of SYN field ?
The presence of SYN field conveys that sequence number is the initial sequence number(ISN). Only the first packet sent from either end shall have this SYN flag set .

24. What is the use of SN field ?
SN field carries the sequence number.
If SYN flag is set, it carries the initial sequence number (ISN).
If SYN flag is clear, then it is the accumulated sequence number of the first data byte of this segment for the current session.

25. What is the use of SACK field ?
SACK enables selective ACK which allows the client to inform on the range of packets received in order and the unreceived packets by which the server shall re-transmit only the packets that were not received by the client.

26. What is the use of Window field ?
Represents the size of the receive window.

27. When will the PSH flag bet set in TCP ?
This tells the receiver to push the data out immediately to the receiving application, rather than waiting for additional data to enter the buffer.

28. Is accept a blocking or non-blocking system call and what is the use of it ?
Accept is a blocking call.  It shall block until the connection request from client.

29. What is a concurrent server architecture ?
There will be one listening socket and multiple connected socket points at the server at any time.

30. What API is used for converting ipv4 address to NBO and vice versa ?
htons(), htonl(), ntohl(), ntohs()
   
31. What is the need for IP protocol, if ethernet can send data using the destination MAC address ?
IP header carries the source ip and destination IP that is required for addressing and routing.

32. What is the use of router, switch, bridge ? List differences between router, switch & bridge.
Router acts as a default gateway on the network segment if the packet has to go to another network. Router maintains table based on IP address & port. Router uses IP layer. Router overwrites the src MAC address with its own MAC address while sending it out.

Switch is a bridge configured to work like a hub in star topology. The received frames are processed & forwarded to the appropriate port using the forwarding table that is based on MAC address & port. Switch uses the data link layer. Switch does not overwrite the src MAC address.

Bridge is a layer 2 device which forwards to all other ports. It does not overwrite the src MAC address.
    
33. What is the use of TTL field ?
TTL determines the maximum number of hops that a packet can take while traveling in the network. While traversing through the network, the routers are expected to decrement the TTL value by 1 before forwarding the packet.

34. Who sets the congestion notification flag ?
The router in the network shall set the ECN flag incase of congestion in network.

35. Is it possible to have connection between multiple socket end points ?
A socket is one endpoint of a communication link between two programs running on the network. Endpoint is a combination of a port number and IP address. Every TCP connection shall be uniquely identified by two endpoints.
   
36. What are the limitations of ethernet ?
There is distance limitation on the maximum distance between devices on ethernet network. Transmission failure can happen as distance increases due to line noise or reduced signal strength or other degradation. Also, ethernet network face congestion problems as they increase in size.    

37. Is it true that data sent over ethernet is automatically broadcasted to every device in the network ?
Yes.

38. What is the difference between CSMA and CSMA/CD ? Why CSMA is not enough ?
CSMA - Broadcast and sense the collision
CSMA/CD - Operates by detecting the occurrence of a collision. Once collision is detected, CSMA CD immediately terminates the transmission so that the transmitter does not have to waste lot of time in continuing.
   
39. What is a Jam signal ? What is back-off period ?
Whenever a collision is detected, the detecting station broadcasts a collision or jam signal to alert other stations that a collision has occurred. Accordingly, every station will wait for a random amount of time.

40. What is the need for MII ?
Originally defined as a standard interface to connect fast ethernet MAC block to PHY chip. This has later been extended as GMII, RGMII, SGMII, XGMII etc..

41. What is the ethernet supported by CAT5 . What is the ethernet supported by CAT5e cable ?
CAT5 supports both traditional and fast ethernet. CAT5e supports Gigabit ethernet.

42. How can you overcome the limitations of ethernet cable ?
Hub can help in overcoming the limitations of ethernet cable.

43. What are the types of ethernet frame formats ? Are they compatible with each other ?
Ethernet II, IEEE 802.3, IEEE 802.2 LLC, IEEE 802.2 SNAP. The different frame types have different format and MTU values, but can coexist on the same physical medium.   

44. What is the role of LLC and MAC layer in ethernet ?
LLC interacts with the upper network layer. It is responsible for handling layer 3 protocols (mux/de-mux) and link services like reliability(error management mechanisms such as ARQ) and flow control. MAC layer interacts with the lower PHY layer. It is responsible for framing and media access control for broadcast media.

45. What is carrier sensing ?
This is a media access control protocol where the transmitter determines whether another transmission is in progress before initiating transmission.

46. What is CSMA-CA ?
Carrier sensing is done but nodes attempt to avoid collisions by transmitting only when the channel is sensed to be idle.
   
47. What is the use of preamble and FCS in Ethernet frame ?
The preamble of ethernet packet allows devices to synchronize the receiver clocks. FCS is a error detecting code added to a frame that helps in discarding the damaged frame in a communication protocol if the FCS number calculated by the destination node mismatches with the FCS number sent by the source node.

48. What are the types of CSMA access modes ?
The types of CSMA access nodes are Persistent, Non-persistent, P-persistent and O-persistent.

49. What is port mirroring ? where is port mirroring used ?
Port mirroring sends a copy of network packets seen on one port to a network monitoring connection on another switch port. It is used in network switch.

50. What is a iterative server ?
Iterative server processes one client request at a time in a sequential manner.

Friday, June 10, 2011

C - II

I have enlisted the questions related to C that can be used for discussion !

1. Will the Free API (after calling Malloc) return the Memory back to the OS or the Application ?

2. How to do array assignment ?

3. What could be the gud way to check 'Close enough' equality using Floats ?

4. What is the Problem of Floating Points with '==' operator in C . On what is that dependent upon ?

5. Tell about the size of 'empty structs' in C ?

6. Why does C language permits an extra comma in initializer list

7. What does the below do ? z = x++ +( y += x++) ;

8. What is nested union ? How is it useful ?

9. How wil you pass unions to functions or pointers to unions ?

10. What is the Behaviour of realloc for NULL argument ?

11. Write a Macro to swap 2 bytes

12. Write a Macro to swap 2 bytes

13. Write small program to Set a Bit, Clear a Bit, Toggle a Bit, Test a Bit (or Demonstrate simple Bit Manipulation in C)

14. Use #define to Set Bit, Clr Bit, Toggle and Test Bit of a volatile status register (Port) - Bit Manipulations to set/clear a bit of a particular Port Register

I would be updating this Part 2 on regular basis till it reaches to around a few reasonable number of C interview questions.

Monday, June 6, 2011

DSP Processor - ADSP 2181

Lets discuss about ADSP 2181 based on below queries:-

1. What is the use of Barrel Shifter in ADSP 2181 ?
2. Give Examples of Variable Declarations & Initialisations in ADSP ?
3. What are the sources of PM Address for the sequencer ?
4. What is the difference between IDLE instruction and Slow IDLE instruction in ADSP-2181 ?
5. Why is Caution required while ending a loop with a JUMP, CALL, RETURN, or IDLE instruction ?
6. How are interrupt vectors spaced in ADSP-2181 ?
7. What happens during interrupt occurance and which registers are pushed on the Stack in ADSP-2181 ?
8. Tell about the Interrupts available in ADSP 2181 ?
9. Difference between Edge-Sensitive and Level-Sensitive Interrups ?
10. What are the types of JUMP instructions in ADSP2181 ? Explain .
11. What is DO UNTIL ?
12. What is Interrupt Force and Clear Register (IFC) ?
13. What are the Status Registers in ADSP-2181 ?
14. Tell about the On-Chip STACKs in ADSP-2181 ?
15. Tell an instruction for Global Enable/Disable of Servicing of Interrupts ?
16. Disabling the interrupts does not affect serial port autobuffering or DMA - TRUE / FALSE ?
17. What is the speciality of 'PowerDown' and 'Reset' Interrupt in ADSP2181 ?
18. Which interrupt can be Level-Sensitive and Which can be Edge-Sensitive ?
19. When does ADSP2181 Mask all interrupt automatically ?
20. What are 3 LOW Power Modes ?
21. Does CLKOUT pint increase power dissipation ?
22. Explain with difference the following modes - Power-Down, Idle and Slow Idle modes.
23. What is MMAP and PMOVLAY Register in ADSP2181 ?
24. Tell about the drawbacks of DO UNTIL and also Tell about the relation of DO UNTIL with Nested Loops ?
25. Tell about Autobuffering w.r.t ADSP ?
26. What is the use of Bit-Reversal Mode in ADSP and its relation with FFT ?
27. What is Memory Overlay ?

Sunday, June 5, 2011

ARM Processor

Hey All,
These are few very simple and general ARM processor questions that can be discussed -

1. What are the types of CORTEX-M series ?
2. How do you select a specific CORTEX-M processor ?
3. What is Trustzone System IP block ?
4. What is the use of T604 ? Have you used it ?
5. Have you come across LINARO ? Have you been involved in LINARO ?
6. What is pipeline shutdown ?
7. what are the kinds of protection available for SRAMS ?
How to use the single bit or double bit fault correction ?
8. What is interrupt pipelining ?
9. Explain the architecture of the CORTEX series ARM that you have used .
10. What is the use of the AMBA interface and where is it present in the architecture ?
11. What is branch prediction ?
12. What is out of order execution ? Have you considered it in selection of processor ?
13. If the pipleline is wider , the instruction throughput is high - True/False ?
14. What is the use of Neon Floating point engine ?
15. In what scenarios can neon do better than normal core ?
16. Is power dissipation more in neon compared to normal core ?
17. Incase of multimedia applications, what is the approximate number of times by which the throughput
is increased compared to normal core ?
18. Is Neon available with Cortex M or Cortex A series ?
19. Have you used RVDS ? Have you used gcc arm toolchain ? Which of these two tools is better ?
20. What is the use of --vectorize option ?
21. Have you used Palladium emulator ? Is it JTAG based ?
22. Have you used XDS510 emulator ?
23. What is Coresight System Trace Macrocell(STM) ?
24. What is the difference between 'intrusive trace' and 'non-intrusive trace' mechanisms ?
25. Which of the following is intrusive - printf, lttng, strace, ftrace, ltrace ?
26. Can you explain the flow from User application and the role of STM driver ?
27. What are the advantages and disadvantages of LTTng ?
28. What is hardware assisted instrumentation ?
29. What is the advantage of hardware assisted instrumentation over software instrumentation ?
30. What is PTM ?
31. What is TPIU ?
32. What is ITM ?
33. What is ETM ?
34. Low latency instrumentation is required for ISR tracing, Bootcode tracing . How is low latency
tracing achieved ?
35. STM cannot trace instructions. It traces only system level calls - True / False.
36. ETM is for data/program instructions & for cache/DMA level instructions - True / False.
37. In Kinetis, can SRAM be configured to act as either NVRAM or EEPROM ? Have you configured or tried it ?
38. How many power modes are there in Kinetis ? Can you tell the wakeup/recovery time for every mode ?
Which mode has the fastest recovery time ? Which mode has the lowest current consumption ?
39. Cortex M4 has Run , Sleep and Deep sleep modes - True / False ?
40. Is 32-pin Cortex M4 compatible with 256 pin Cortex M4 processor ?
41. What is I2S interface ?
42. What are the features of Cortex M4 ?
43. Tell about the Exception Handling in ARM processor. What does the ARM Core do automatically for every exception ?
44. Can you tell about DSP in ARM7TDMI or DSP in STRONGARM or DSP in ARM9E ?
45. Why should you design the DSP algorithm in general ARM architecture so that saturation is not required ?
46. Tell about AIF(Arm Image Format) and AOF(Arm Object Format) ?
47. What are the Memory initialization directives ?
48. What is the use of 'SWI' in ARM assembly ?
49. How to Represent a Digital Signal in ARM ?
50. Give Example of STMFD w.r.t Stack Operation push/pop ?
51. Tell about Extended Multiply Instructions in ARM
52. Tell about the NORMAL Multiply Instructions in ARM
53. Tell about ADR's relation with LDR and the Advantage of using LDR together with '=' ?
54. When does the Processor Stall in ARM and what is the pipeline hazard in ARM?
55. What is called 'pipeline bubble' in ARM ?
56. What is Saturating Arithmetic ? Explain
57. Tell the 2 software methods available to remove interlocks following load instructions
58. Tell about 'Load Scheduling By Preloading' and 'Load Scheduling by unrolling' ?
59. How will you flush the instuction Cache in ARM processor ?
60. List the issues when porting C code to the ARM processor ?
61. What are the advantages of writing in Assembly in ARM processor?
62. Explain this -> "AREA |.text|, CODE, READONLY"
63. What is the use of the 'EXPORT' directive ?
64. What is the use of various directives ?
65. How to build using command line tools w.r.t ARM ?
66. Write a simple square.s program in ARM assembly called from a C file ?
67. What will you change that program when calling ARM code from C compiled as Thumb ?
68. How will you allow Thumb C code to call the ARM assembly Code ?
69. What is the use of 'RN' directive in ARM assembly ?
70. What imports the libraries like printf automatically in the assembly side of ARM ?
71. What is the DCB directive and its relation with strings ?
72. What is ARMulator ? Where and How have you used it ?
73. How will you handle the Register Shortage problem in ARM ?
74. Relation between CPSR flags, S Suffix Instructions and Comparison Instructions ?
75. What is Conditional Execution in ARM ?
76. What is single issue multiple data (SIMD) processing ?
77. What is a Coprorcessor / CP15 in ARM ?
78. What does the 'B' mean in LDRB or What is the difference between LDR and LDRB in ARM ?
79. What is the use of Write-Back ?
80. When should i use '!' in ARM programming and where is it Not Allowed to be used in ARM programming ?
81. Tell about 'Single Data Transfer' and 'Multiple Data Transfer' in ARM
82. How will you manually Enable / Disable an interrupt in ARM Processor ?
83. Tell about MRS and MSR instructions ?
84. Can you tell a 32-bit branch instruction and the way you used it ?
85. When have you used Thumb instructions in ARM processor ?
86. Write a program to mask bytes in ARM assembly ?
87. ARM7 family of processors does not use any branch prediction scheme. Neither
ARM9 nor ARM9E family implements branch prediction - True / False
88. The ARM11 micro-architecture uses two techniques to predict branches - True / False
89. What is Translation Lookaside Buffer (TLB) ?
90. What are the types of addressing modes in ARM ?
91. Can you brief up the evolution of ARM architecture ?
92. Why ARM7TDMI alone highlights the features that it supports in its naming and why not other ARM architectures ?
93. When will you choose to use ARM and when will you choose to use Thumb instructions ?
94. Can you explain the operation of ARM7 pipeline for simple instructions ?
95. Can you tell about function performed by this instruction - ADD r3, r5, r12 ?