Need a discount on popular programming courses? Find them here. View offers

Harshita Srivastava | 06 Jun, 2022

Technical Interview Questions and Answers [Updated]


There can be nobody in this techy world who has never know about networking and its importance. Network engineering is one of the trendiest jobs of out times.

Earlier, if a person wishing to appear for an interview needs to carefully go through all the books and materials available page by page. But the internet, a networking system has made it all so easy. Regardless of whether you're a fresher or an experienced person, be prepared to face some basic networking questions if you're preparing for a networking interview.

Top Technical Interview Questions and Answers

This article covers Technical Interview questions and answers from the basic networking, C, C++, Java, and OS technology.

Networking Interview Questions

Question: What is Computer Networking?

Answer: A computer network is a collection of connected computers for resource sharing purposes. Today's most common tool shared is an Internet connection.

Question: Difference between communication and transmission?

Answer: Transmission is a physical data process that involves problems such as bit polarity, synchronization, clock, etc. Communication means full information exchange between two communication networks.

Question: What is a gateway?

Answer: A gateway is a Node in a network. They accept a package formatted for a protocol and before resending it, they convert it to a package formatted for another protocol.

Question: What is Network Mask?

Answer: A mask is a bit pattern for identifying the address of the network/subnet. The IP address comprises two components: the address of the network and the address of the host.

The IP addresses are categorized into different classes which are used to identify the network address

Question: What are the differences between TCP/UDP?

Answer: TCP (Transmission Control Protocol): TCP is a link-based protocol. A link can be made between client and server and from then on some data can be sent along the path.

When you send a message along with a TCP socket, you'll get it if the connection fails completely. If it gets lost along the way, the client can re-demand the missing part. It means integrity; information will not be compromised.

UDP(User Datagram Protocol): UDP is a connectionless protocol. With UDP you send messages (packets) across the network in chunks.

When you send a message, you don’t know if it’ll get there - it could get lost on the way. If you send two messages out, you don’t know what order they’ll arrive in.

Question: Compare IPv4 and IPv6 protocol?

Answer: Ipv4 and Ipv6 are internet protocols that are applied to the network layer. Ipv4 is currently the most commonly used protocol and Ipv6 is the next generation internet protocol.

  • Ipv4 is the fourth version of the Internet protocol which uses 32-bit addressing while Ipv6 is a 128-bit protocol addressing the next generation of the Internet.
  • Ipv4 makes 4,294,967,296 unique addresses while Ipv6 can have 340-undecillion unique addresses.
  • Ipv4 Address Notation: 239.255.255.255, 255.255.255.0. Eight groups of hexadecimal quartets separated by colons between them represent IPv6 addresses.

Question: How URL is processed into a browser?

Answer: There is no exact answer to this question, even though here are the steps of how a URL is processed:

  • To find the URL IP address, the browser contacts the DNS server.
  • DNS returns the website's IP address.
  • The client opens the TCP port 80 web server link.
  • The browser fetches the HTML code of the page requested.
  • In the display window, the browser renders the HTML.

Question: What are the different Routing protocol?

Answer: 

  • Border Gateway Protocol
  • Routing Information Protocol
  • Open Shortest Path First

Question: What is MAC address?

Answer: In a network, MAC address is the unique identification address for a device. Normally the MAC address is stored on the network adapter card in ROM.

Question: What are the different types of networking devices?

Answer: 

1. Hub

The network hub is a node system that links multiple computers at one point Centralized communication devices are the concentrators, attached in the middle of the star link network. All devices that are connected to a network hub share the bandwidth that is available equally.

2. Repeater

Repeater is electronic devices used to avoid distortion in signal transmission. A repeater receives the signal in the network, regenerates the original bit then transfers it through the same channel to avoid distortion.

3. Router

The router is a system for linking one network (LAN, WAN) to another (LAN, WAN) network. The router selects the most suitable route for transmitting the signal depending on the location of the sender and receiver.

4. Gateways

Gateways are used to convert one format to another format in a network. If two parts of the same network have different communication formats connecting them requires a gateway. They operate in all seven layers of the OSI model.

5. Bridges

Network bridges are intelligent devices that process and record signal traffic information between devices in networks. Then the bridge uses this information to decide the most efficient path between a transmitting and receiving device for data transfer without having to send it to any computer in the network.

Java Interview Questions

Question: What is JAVA?

Answer: Java is an object-oriented programming language. Java was designed for digital consumer devices but was later moved to the Internet. Now Java is a widely-used programming language for internet. Java-developed software can run on any of the world's hardware or operating systems.

For More info read our blog.

Question: Application where it is possible to develop in Java?

Answer:

Standalone Applications: Under the computer's operating system, a standalone application is a program running on our local computer just like a C or C++ program.

Applets: An applet is a small program that flies over the Internet and runs on the client computer through a Java-compatible web browser like Internet Explorer or Netscape Navigator.

An applet is stored in the webserver and travels across the network and downloads it in the client machine dynamically when a client computer requests it. Only by embedding it into an HTML document, such as a sound file or image file or video clip, can Applet be executed.

Distributed Applications: To achieve distributed application in Java application, Java divides applications into small groups which can run on separate machines. The objects used can interact with each other in these programs. These systems are known as Distributed applications

Web Applications: These are a program running on web servers. Web servers process these applications when we search for a website using its URL in the browser. The web browser sends a request for that particular website to the webserver. After running the program the server sends the result to the client.

Question: Explain Java language specification?

Answer: The Java language specification is a set of rules that should follow when writing a Java program, that includes Java programming language syntax and semantics. The specifications include API, JDE, IDE.

API: The Application Program Interface (API) is still expanding specification that contains predefined classes and interfaces for developing Java programs.

JDK: Java Development Kit (JDK) is used for developing test Java programs, which contains a separate program that invokes each command line.

IDE: Integrated Development Environment (IDE) consists of a graphical user interface that enables Editing, compiling, building, debugging, and online help. Simply enter the source code in one window or open an existing file in a browser, then click a button, menu item, or function key to compile and run the program.

Question: What is RMI and RMI architecture?

Answer: Remote Method Invocation (RMI) enables executing java object on one machine and invoking the method of executing a Java object on a different machine.

RMI architecture consists of 4 layers:

  • Application layer: contains the actual object definition.
  • Proxy layer: consists of stub and skeleton.
  • Remote Reference layer: Sets the byte stream from the transportation layer and passes it to the proxy layer.
  • Transportation layer: Responsible for the actual communication between machine to machine.

Question: What is Servlet chaining?

Answer: Servlet chaining enables one to participate in one or more servlets for servicing a single request. Through servlet chaining, the output of one servlet will be piped to the input of the next servlet. The cycle continues before reaching the last servlet. The output would then be returned to the client.

Question: What is connection pooling?

Answer: Opening a server link with servlets is a major bottleneck because for every page query new connection is established, which is time-consuming.

With a connection pool, we can only duplicate the resources that we need to replicate instead of the whole servlet and also it can manage the size of the pool.

Question: What are cookies?

Answer: Cookies are a tool used by a servlet to keep a client holding a small amount of user-related state information. Simply, small data sent to a browser by a web server that can be read back from that browser later

Question: How to track a client?

Answer: There are two ways in tracking client from servlet API, they are:

  • Using session tracking
  • Cookies

Question: What is JDBC?

Answer: JDBC is a series of SQL statements in Java API. This API consists of a set of classes and interfaces that allow programmers to write pure applications for Java Database.

Question: What is the difference between JDBC and ODBC?

Answer: 

  • JDBC - Java Database Connectivity, ODBC- Open Database Connectivity
  • OBDC is for Microsoft and JDBC is for Java applications
  • As ODBC uses C interface it can’t be used directly with Java
  • For simple queries, ODBC blends simple and advanced functionality and has complex options. But JDBC is designed to keep things simple and allow advanced capabilities when necessary
  • ODBC requires manual installations while the JDBC code is automatically installable.

The Complete Java Development Bootcamp

C Programming Interview Questions

Question: What is C language?

Answer: The C programming language is a standardized programming language developed for use on the UNIX operating system. C is the most common programming language for writing system software, although it is also used for writing applications.

Question: What are the different storage classes in C?

Answer: C has three storage types: automatic static and allocated. Variable with block range and automatic processing length without a static specifier. Block scope variables and static specifier variables have static scope. There is also a dynamic scope for global variables (i.e., file scope) with or without the static specifier. Memory obtained from calls to malloc( ), alloc( ) or realloc( ) belongs to the memory class allocated.

Question: What is the output of printf("%d")?

Answer: If we write printf("%d,"x); this means that the x value will be printed by the compiler. But as here, after %d there is nothing, so the compiler will show garbage value in the output window.

Question: What is the difference between printf( ) and sprintf( ) ?

Answer: Sprintf ( ) writes the character array data while printf(...) writes the standard output machine data.

Question: Can you tell how to check whether a linked list is circular?

Answer: Create two points and set them both at the start of the list, program:

while (pointer1) {
pointer1 = pointer1->next;
pointer2 = pointer2->next;
if (pointer2) pointer2=pointer2->next;
if (pointer1 == pointer2) {
print ("circular");
}
}

Question: What is hashing?

Answer: Hashing means grinding up, and that's what hashing is all about. A hashing algorithm's core is a hash function that takes your good, smooth data and grinds it into a random-looking whole.

The concept behind hashing is that some data either does not have an inherent order (such as images) or are expensive to compare. If the data does not have an underlying order, comparison searches can not be performed.

Question: Explain the difference between strings and character arrays?

Answer: A major difference is: string will have static storage length, while string will not have static storage duration as a character set unless the static keyword is used to indicate explicitness.

  • The multi-byte character sequence we usually call string is used to initialize a static space length range. The width of this set is enough to contain these characters in addition to the terminating NUL code.
  • It is not specified what happens if this array, i.e., string, is modified.
  • The same memory field may be shared by two strings of the same value.

Question: Why n++ executes faster than n+1 ?

Answer: To carry out the increment operation, the expression n++ requires a single machine instruction such as INR, while n+1 needs more instructions.

Question: What is the purpose of main( ) function?

Answer: The main ( ) function invokes other functions within it. It is the first function to be written when running a program.

  • It is a starting function
  • It returns an int value to the environment that called the program
  • Recursive calling for main ( ) is also enabled
  • It is a user-defined function
  • Execution of the program ends when the main ( ) function closes.
  • It has two arguments 1) argument count and 2) argument vector

Question: What is the difference between %d and %*d in c language?

Answer: The % d gives the variable's original value and the %* d gives the variable's name.

eg:-

int a=10,b=20;
printf("%d%d",a,b);
printf("%*d%*d",a,b);

Here result for the first printf will be 10,20 and the result for the second printf give memory allocation that can say 1760.

C++ Interview questions

Question: What is C++?

Answer: C++ is an object-oriented programming language. C++ retains almost all elements of the C language, simplifying memory management and adding multiple functions. C++ retains C features that allow access to low-level memory, but also provides the programmer with new tools to improve memory management.

Question: What is a constructor?

Answer: A constructor is used to creating and initialize an object. It also generates a digital feature vtable. It's special in a category from other processes.

What is a constructor? - Technical Interview Questions

Question: What is inheritance?

Answer: Inheritance allows one class to reuse another class' state and actions. The derived class inherits and expands the base class' properties and method implementations by modifying methods and adding additional properties and methods.

Question: What is a class?

Answer: A class is an extended definition of a data structure: it can contain both data and functions instead of holding only data.

Question: How do you know that your class needs a virtual destructor?

Answer: If we have even one virtual function in the class, we need to make a virtual destructor. This will allow you to remove a dynamic object from a base class object through a caller.

Question: What is the difference between realloc() and free()?

Answer: The free subroutine removes a memory block that the malloc subroutine had previously reserved. The undetermined result occurs if the pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur.

The realloc subroutine adjusts the size of the memory block referring to the number of bytes defined by the Size parameter by the Pointer parameter and returns a new pointer to the row. The pointer defined by the Pointer parameter must have been generated with the subroutines of malloc, calloc, or reallocation and not dealing with the subroutines of free or reallocation.

Question: Write a function that can reverse a linked-list?

Answer: 

void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur-> next = head;
for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}
curnext->next = cur;
}
}

Question: What is the difference between C++ & Java?

Answer:

C++

Java

Classes and functions can be templated.

Classes and methods can be genericized

Parameters can be any type or integral value.

Reference type parameter only

For each type parameter, separate class or function copies are likely to be created when compiled.

For all types of parameters, there is only one type of class or function is compiled

The templated class or a function's source code must be included, in order to use it

Signature of the class or function from a

compiled class is sufficient to use it.

Templates can be specialized

Cannot be specialized (generic)

The bounding type parameter is not allowed but is supported by metaprogramming.

Supports upper and lower bounding of category parameters with "extends" and “super”

For static methods and variables, the type parameter of the templated class can be used

For static methods and variables, the form parameter of the templated class can not be used.

There is no sharing of static variables between classes of different types of parameters.

Static variables are shared among instances of different type class parameters

Question: What is RTTI?

Answer: Runtime type identification (RTTI) allows you to find an object's dynamic form when you only have a pointer or a base type reference. RTTI is the official way to discover the type of an object in standard C++ and to convert a reference or pointer type.

Question: How do virtual functions work in C++?

Answer: A virtual function relies on a virtual table or board. If any of a class's functions are considered virtual, a v-table is built that stores addresses of this class's virtual functions. The compiler also adds in all such classes a secret vptr variable that points to that class's vtable.

If a virtual function in the derived class is not overridden, the vtable in the derived class must store the function address in its parent class.

Operating system Interview Questions:

Question: What is an operating system (OS)?

Answer: An Operating System (OS) is a computer user-hardware interface. There are two main purposes of operating systems. One is to ensure that a computer system works well. Another is that it offers a framework for system development and implementation.

Some popular Operating Systems include Linux, Windows, OS X, VMS, OS/400, AIX, z/OS, etc.

Question: What are the advantages of a multiprocessor system?

Answer: There is a significant increase in throughput with an increased number of processors. However, because they can share resources, it can save more money. Finally, there is also an increase in overall performance.

Question: What is SMP?

Answer: SMP is a short form of Symmetric Multi-Processing. It's the most popular multi-processor device type. Each processor runs an identical copy of the operating system in this system and these copies communicate with each other as needed.

Question: What are the types of Operating System?

Answer: 

  • Batch operating system
  • Time-sharing operating systems
  • Distributed operating System
  • Network operating System
  • Real-Time Operating System

Question: What is the best page size when designing an operating system?

Answer: Paging size varies from system to system. In order to create a suitable page size, there are numerous factors to consider, such as page table, paging time, and its effect on the overall operating system performance.

Question: What is caching?

Answer: Caching is the storage for limited data and processes using a region of fast memory. Because of its high access speed, cache memory is typically very effective.

Question: Explain why Ubuntu OS is safe and not affected by viruses?

Answer:

  • It does not accept malicious emails and content, and many security checks will be carried out before any email is opened by users.
  • Ubuntu uses Linux, i.e. a super-secure O.S system
  • Unlike other O.S, countless Linux users will be able to see the code at any time and solve the problem if any.

Question: What is the role of paging?

Answer: Paging is a memory management system that allows a process to be non-contiguous in the physical address space. This eliminates the considerable problem of fitting varied chunks of memory in the backup store.

Question: What is the Translation Lookaside Buffer (TLB)?

Answer: In a cached system the base addresses of the last couple of referenced pages are stored in registers called the TLB which helps with faster lookup. TLB includes the most recently used page table entries. Typically, each virtual memory link requires two accesses to physical memory-one to get the correct page table entry and one to get the requested information. It limits the use of TLB in-between to just one physical memory access in TLB-hit cases.

Question: How are server systems classified?

Answer: It is possible to identify database systems as either computer server systems or file server systems. In the first example, customers are provided with an application to submit requests for action. In the second case, there are provisions for creating, accessing, and updating files for clients.

People are also reading:

STAY IN LOOP TO BE AT THE TOP

Subscribe to our monthly newsletter

Welcome to the club and Thank you for subscribing!

By Harshita Srivastava

Harshita is a graduate from Indian Institute of Technology, Kanpur. She is a technical writer and a blogger. An entrepreneurship and machine learning enthusiast, who loves reading and is a huge fan of Air Crash Investigation!

View all post by the author

Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

In this article

Learn More

Please login to leave comments