JOBSEEKER?

Software Engineering Interview Questions

Practice for Software Engineering interviews by solving TestDome questions. Our interview questions are used by more than 7,000 companies and 450,000 individual test takers.

Jobseekers: Certify Your Knowledge

Take a Certification Test

Companies: Use Our Tests for Screening

Buy a Pack Of Candidates

Need to practice your Software Engineering skills for an upcoming job interview? Try solving these Software Engineering interview questions that test knowledge of OOP, data structures, design patterns, and other skills. We’ll provide feedback on your answers, and you can use a hint if you get stuck.

These Software Engineering interview questions are examples of real tasks used by employers to screen job candidates such as software engineers, web developers, mobile developers, and others that need to understand how software systems work together, how to optimize them, and how to design systems to avoid potential issues.

1. HTTP Request

HTTP life cycle Web development
   
Easy  

A user types www.testdome.com into their browser's address bar for the first time, presses enter, the webpage loads, and renders successfully.

Select the statements that are correct.

(Select all acceptable answers.)

The browser, being unable to locate www.testdome.com in the local cache, contacts a DNS resolver to find the servers IP address.
The browser opens a TCP connection to the server.
The server sends the browser a GET request containing the request parameters.
The browser sends the server a request with the status code 200, indicating that it has successfully connected.
The servers response contains the web page, encoded in the format specified by the Content-Encoding attribute.
   


2. Web App Architecture

Software architecture Solution architecture
   
Easy  

During a discussion about architecture for a new web app the following sketchup was made:

Web app architecture

The authors of the sketchup forgot to write the descriptions for three components marked with red numbers.

Select the best choice, regarding the context, for the description that should define each component.

Component 1.


Component 2.


Component 3.

   


3. Big O Notation

Complexity
   
Easy  

For the following pseudocode functions, choose the big O notation that accurately describes its worst-case complexity.

function GetFirstElement(elements : array) : integer
  return elements[0]
end function

function DisplayPairsFromList(elements : array)
  integer i = 0
  integer size = elements->Count()
  loop (while i < size)
    integer j = 0
    loop (while j < size)
      Display(elements[i] + ", " + elements[j])
      j = j + 1
    end loop
    i = i + 1
  end loop
end function

function Recursive(number : integer) : integer
  if (number <= 1)
    return number

  return Recursive(number - 4) + Recursive(number - 2)
end function
   


4. Serialize Cart

Inheritance OOP
   
Easy  

In a language that supports OOP paradigm, we have the following code that serializes the content of a shopping cart to JSON format:

class ShoppingCart
  private content : Dictionary<int, string> 

  public function serialize() : string
    return new JsonSerializer().serialize(content.clone())
  end function
end class

class JsonSerializer  
  public function serialize(value : Dictionary<int, string>) : string
    ' Code that serializes dictionary to JSON format and returns it as string
  end function
end class

A client wants to have the possibility of allowing loosely coupled plugins to be able to serialize the shopping cart content to their own formats (e.g., XML). Select lines of code that, together, would extend the code above to allow this.

(Select all acceptable answers.)

class JsonSerializer
Should be changed to:
class JsonSerializer inherits ISerializer
Add interface definition:
interface ISerializer
  public function serialize(Dictionary<int, string>) : string
end interface
Add a definition for enumeration that will be extended as new plugins will be added (e.g., to add XML serialization):
enumeration SerializerType
  Json,
  Xml
end enumeration
Change ShoppingCart's serialize implementation to one like below (e.g., to add XML serialization):
public function serialize(serializer : SerializerType) : string
  if(serializer == SerializerType.Json)
    return new JsonSerializer().serialize(content.clone())
  else if(serializer == SerializerType.Xml)
    return new XmlSerializer().serialize(content.clone())
  else 
    throw Error("Not implemented error!");
  end if    
end function
Change ShoppingCart's serialize implementation to:
public function serialize(serializer : ISerializer) : string
  return serializer.serialize(content.clone())
end function
Change the ShoppingCart's access modifiers of data members from private to public. Like:
private content : Dictionary<int, string>
to:
public content : Dictionary<int, string>
so that plugins can directly manipulate and save the shopping cart.
   


5. Stack vs Queue

Data structures Queue Stack
   
Easy  

Answer the questions below regarding correct usage of data structures.

Given an empty object stackOfNumbers of type Stack, review the sequence of function calls:

stackOfNumbers->Push(10)
stackOfNumbers->Push(12)
stackOfNumbers->Push(13)
stackOfNumbers->Peek()
stackOfNumbers->Push(8)
stackOfNumbers->Pop()
stackOfNumbers->Push(9)
stackOfNumbers->Peek()

If Pop() were called again, it would return:


Given an empty object queueOfNumbers of type Queue, review the sequence of function calls:

queueOfNumbers->Enqueue(10)
queueOfNumbers->Enqueue(12)
queueOfNumbers->Enqueue(13)
queueOfNumbers->Peek()
queueOfNumbers->Enqueue(8)
queueOfNumbers->Dequeue()
queueOfNumbers->Enqueue(9)
queueOfNumbers->Peek()

If Dequeue() were called again, it would return: 


In which one of these scenarios might you use a Queue instead of a Stack?

   


6. RESTful Web Services

HTTP REST Web development
   
Hard  

Select the statements about RESTful web services that are correct.

(Select all acceptable answers.)

In HTTP/1.1, both the PUT and POST methods requests can be used to create and update resources.
A RESTful web service stores the client state as a session on the server.
In HTTP/1.1 it is mandatory that all POST requests create a new resource.
REST extends the SOAP (Simple Object Access Protocol) by allowing HTML requests and multiple data formats.
The Accept header field can be used to tell a RESTful web service to respond in a specific format.
   


7. Font Formatting

Design patterns OOP Structural patterns
   
Hard  

A word processor uses the following code for defining font format:

class FontFormat inherits Object
  private fontName : string
  private fontSize : int

  public constructor(name : string, size : int)
    fontName = name
    fontSize = size
  end constructor

  public function getFontName : string
    return fontName
  end function

  public function getFontSize : int
    return fontSize
  end function

  override public function equals(obj : object) : bool
    if(!(obj instanceof FontFormat))
      return false
    end if
    
    FontFormat f = (FontFormat)obj
    return f.getFontName() == fontName && f.getFontSize() == fontSize
  end function

  override public function getHashCode() : int
    return fontName.getHashCode() ^ fontSize.getHashCode()
  end function
end class

Analysis shows that even the largest documents use fewer than a hundred different combinations of font name and size. The same analysis shows that the application sometimes uses thousands of FontFormat objects, most of which share the same font name and size.

(Fill in the blank with the software design pattern that solves the issue.)

The software design pattern can be used to minimize the memory footprint by sharing FontFormat objects.

   


If you feel ready, take one of our timed public Software Engineering Interview Questions tests:
Software Engineering

Software Engineering Online Test (Easy / Hard)

Not exactly what you are looking for? Go to our For Jobseekers section.
Dashboard Start Trial Sign In Home Tour Tests Questions Pricing For Jobseekers