Explore common computer science interview questions you may be asked in your job interview and get advice on how to answer them effectively.
Whether you're a web developer, a programmer, a video game designer, an animator, or preparing for any other position involving computer science, now’s the time to start preparing for some of the questions you could face in your upcoming interview. Proper preparation is the key to showing the interviewer you have the skills they need and demonstrating confidence in your answers.
When going into a job interview, it’s important to carefully read the job description to develop a feel for what questions you may be asked. Beyond the job itself, also take your time to research the company. This can be helpful for learning more about the company culture and possibly even some of the systems they use. The more context you have about the job and company, the more precise and focused you can be in your preparation.
This list covers 15 common computer science interview questions asked by employers. Some you may already know, and others could be new. Regardless of your familiarity, rehearse how you would answer them to be clear in your explanations on interview day.
What the interviewer wants to know: What is your understanding of fundamental computer science topics?
How to answer: A file is a resource used to store information. You can use different types of computer files depending on the kind of information you wish to contain. This can include text files, image files, data files, and more that are stored on a computer’s hard drive.
Similar questions the interviewer may ask:
What are some types of files and their purpose?
Where are computer files stored?
What the interviewer wants to know: Do you understand how and when each memory type should be used?
How to answer: Primary memory refers to a computer's internal memory system, whereas secondary memory is external. Primary memory is temporary. When a computer is powered off, primary memory loses its data. RAM (random access memory) is an example of primary memory where information can be read but not saved when power is lost. Secondary memory, however, is permanent because the information is stored on an external device such as a USB.
Similar questions the interviewer may ask:
What are the differences between primary and secondary memory?
How do you determine the type of memory to use?
What the interviewer wants to know: Do you understand specific details of object-oriented programming?
How to answer: In object-oriented programming, a constructor is a code section that runs once a class is created. The constructor initialises an object and is called automatically. It shares the same name as the class and runs any time a new object of the same name is created.
Similar questions the interviewer may ask:
When is a constructor called?
How many times is a constructor run?
What the interviewer wants to know: Can you articulate the relationship between constructors and destructors?
How to answer: Similar to constructors, destructors also share the same name as their class. However, a destructor is called to destroy the class created by the constructor. The purpose of a destructor is to free memory space used by the object.
Similar questions the interviewer may ask:
Explain the relationship between a destructor and a constructor.
What are some benefits of using a destructor?
What the interviewer wants to know: Are you knowledgeable about basic computer science systems?
How to answer: An operating system is a crucial software software that a computer uses to manage its various system processes, including hardware, software, and memory. Computers need to manage running multiple programs simultaneously that require access to various parts of the computer including its central processing unit, memory, and storage. The operating system allows this to happen simultaneously and smoothly.
Similar questions the interviewer may ask:
What are some of the basic tasks of an operating system?
Why are operating systems crucial to the function of a computer?
What the interviewer wants to know: Can you accurately define a class and how it relates to objects?
How to answer: In object-oriented programming, a class is used to create and define objects, which are specific class instances. For example, if televisions were to be a class, the individual components or attributes such as screen dimension, hardware components, and cable provider represent the various objects that define a class.
Similar questions the interviewer may ask:
Explain the relationship between a class and an object.
What is meant by the properties of an object?
What the interviewer wants to know: What is your knowledge of different class types?
How to answer: An abstract class is a specific type inherited from another class. Because it’s inherited, it can’t be used to create objects, or in other words, it can’t be instantiated.
Similar questions the interviewer may ask:
What are some different examples of class types?
What characteristics make an abstract class unique?
What the interviewer wants to know: What is your knowledge of different class types?
How to answer: In object-oriented programming, a class variable is sometimes referred to as a member variable or static variable, depending on the programming language. It defines an attribute or variable of a class that is shared by all class instances.
Similar questions the interviewer may ask:
What is the function of a class variable?
What is a static variable?
What the interviewer wants to know: Can you accurately define an object and how it relates to a class?
How to answer: As mentioned earlier, an object represents a specific class instance. Whilst a class can represent a type of object, such as a house, an example of an object would be your specific house or your neighbour's specific house. In programming, the object is what’s being defined.
Similar questions the interviewer may ask:
What are some different examples of an object?
Explain the relationship between an object and a class.
What the interviewer wants to know: Do you understand the various types of access modifiers, including when each should be used?
How to answer: Access modifiers are keywords used to control the accessibility of classes inside a package. You can use four main access modifiers: public, private, protected and default. Public access modifiers are available to anyone within or outside the class and package and are the least restrictive. Private access modifiers, on the other hand, are the most restrictive and can’t be accessed outside the specific class. Protected access modifiers are accessible from subclasses within the package, and default access modifiers don’t have a specified access modifier for a class so they’re only accessible within a package.
Similar questions the interviewer may ask:
What are the four types of access modifiers?
How do you determine the type of access modifier to use?
What the interviewer wants to know: What is your depth of understanding of artificial intelligence?
How to answer: Artificial intelligence is a process in which computer systems are trained to simulate human intelligence. The purpose of artificial intelligence is to allow machines to rationalise information and make informed decisions without any human assistance.
Similar questions the interviewer may ask:
What are some advantages of artificial intelligence?
What experience do you have working with artificial intelligence?
What the interviewer wants to know: What is your depth of understanding of machine learning?
How to answer: Machine learning is a subset of artificial intelligence. By understanding how humans learn, the same process is replicated in computers to allow machines to learn and become better at predicting outcomes. It allows information to be analysed on a large scale.
Similar questions the interviewer may ask:
How can machine learning be used to improve system processes?
Can you tell us about any projects you have worked on where machine learning was utilised?
What the interviewer wants to know: What is your knowledge level of deep learning, and how is it related to machine learning?
How to answer: Deep learning is a subset of machine learning. With deep learning, machines can process unstructured data that would need human pre-processing in typical machine learning applications. Deep learning models contain more algorithmic layers called artificial neural networks that allow this automated learning.
Similar questions the interviewer may ask:
What do you know about deep learning and how it relates to machine learning?
How is deep learning different from typical machine learning algorithms?
What the interviewer wants to know: Do you understand the fundamentals of algorithm development?
How to answer: An algorithm is the specific procedure to solve a defined problem. A sequence of events occurs for a series of inputs to create an output then, and that process is what’s known as an algorithm.
Similar questions the interviewer may ask:
Describe the steps involved in developing an algorithm.
How do you test and improve previously developed algorithms?
What the interviewer wants to know: What is your understanding of important data structures?
How to answer: An array is a type of data structure that stores data of the same type (such as an integer) in database systems often referred to as contiguous memory locations. It allows related sets of values to be easily sorted and accessed. Arrays are one of the most common forms of data structures.
Similar questions the interviewer may ask:
What are some common types of data structures?
What are some of the applications of arrays?
Wherever you are on your computer science journey, consider taking highly rated courses of all levels on Coursera to further develop your computer science skills and conceptual understanding. For beginners, Fundamentals of Computing Specialisation from Rice University covers entry-level computer science topics and will introduce you to Python programming.
More experienced learners can prepare for a career in computer science with Princeton University’s Computer Science: Algorithms, Theory, and Machines. This course will help you learn about many of the modern applications of computer science today and touch on the field’s history.
Editorial Team
Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...
This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.