fbpx

30 Interview Questions and Answers for Computer Science

 

For freshmen and experienced applicants looking to land their ideal job, here are some sample computer science interview questions.

1) What is the computer system?

A computer system is a combination of memory, CPU, peripheral devices that are connected to it, and OS (Operating System).


2) List out components of a computer system

The components of a computer system are:

  • CPU (Central Processing Unit) including control unit and arithmetic logic unit
  • Memory like primary and secondary
  • Input and output devices like keyboard mouse, printer scanner, etc.

3) What is a microprocessor?

A microprocessor is an integrated circuit having all the functionality of a central processing unit of a PC.


4) Explain the class variable

Variables represent a memory of class, which it shares with each and every instance.


5) What is SDLC?

SDLC stands for Software Development Life Cycle is a process that produces quality software products in less time. The stages involved by SDLC are: 1) planning, 2) design, 4) construction, 5) testing, and 6) deployment.


6) Explain the meaning of file.

A file is a named location that stores information or data permanently. It is always stored in the storage device using a file name with primary and secondary names, which is separated by a “.”(DOT).


7) What is a programming language?

A programming language is a collection of grammar rules for giving instructions to computer or computing devices in order to perform achieve task.


8) What is Integrated Development Environment?

An IDE is a GUI-based software program. It is designed to help programmers build applications with all the needed programs and libraries.


9) Explain the framework

The framework is a platform for making software applications. It provides the basis on which developers can build programs for a specific platform. For example, a framework may include predetermined classes as well as functions. It can be used to process inputs, manage hardware, and interact with system software.


10) What is an Interface?

The interface is similar to a class in Java, but it is a collection of abstract methods. A class can have more than one interface.


11) What is a class?

A class is a blueprint for creating objects. A class contains methods and variables which are class instances.


12) Distinguish between abstract class and interface

The difference between class and interface is:

Abstract classInterface
Abstract class does not support inheritance.The interface supports multiple inheritances.
An abstract class would contain constructor.The interface does not contain a constructor.
An abstract class is declared using the “Abstract” keyword.The interface is declared using the “interface” keyword.
It can be used with all access modifiers.It can be used with only public access modifier.

13) What is an abstract class?

A class having an abstract keyword is called an abstract class.


14) What is an array?

An array is a container that keeps a specific number of similar data types.


15) What is a constructor?

A constructor is a method that is used to create a class object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.

 

16) Define Cin and Cout

Cin and Cout are objects used for input and output files, respectively.


17) What is the difference between C and C++?

The difference between C and C++ is:

CC++
It is a Procedural Oriented language.It is an Object-Oriented Programming language.
C language follows a Top-Down programming approachC++ follows a bottom-up programming approach.
The file extension of a C program is .cThe file extension of a c+ + program language is.cpp
In the C programming language, a big program code is divided into small pieces, which is called functions.In the C++ programming language, a big program code is divided into Objects and Classes.
Structure in C does not provide the feature of function declaration.Structure in C++ provides the feature of declaring a function as a member function of the structure.

18) List the types of constructors

There are two types of constructors: 1) parameterized constructor and 2) default constructor.


19) What is artificial intelligence?

Artificial Intelligence or machine intelligence is a common term that is used to build smart machines capable of performing tasks. The main aim of AI is to solve problems in a way that are better and faster.

Artificial Intelligence is defined as the ability of a digital computer or computer-controlled robot (Intelligent entity) to perform tasks intelligently without being explicitly instructed.


20) What is machine learning?

Machine Learning is a system that can learn from an excellent example through self-improvement and without being explicitly coded by a programmer.


21) What is deep learning?

Deep learning is computer software that mimics the network of neurons in a brain. It is a subset of machine learning and is called deep learning because it makes use of deep neural networks.  It is a field that is based on learning and improving on its own by examining computer algorithm


22) List out different OOPS principles?

The basic OOPS principle are: 1) encapsulation, 2) abstraction, 3) inheritance and 4) polymorphism.


23) Explain the various type of access modifiers

There are four types of access modifiers:

  • Private: Visible to a particular class
  • Public: Visible to the world
  • Protected: Visible to specific packages as well as subclass

24) What is the difference between a compiler and an interpreter?

The difference between a compiler and an interpreter is:

CompilerInterpreter
Compiled code run faster.Interpreted code run slower.
Generates output program (in the form of exe), which can be run independently from the original program.Do not generate an output program. So the programmer evaluates the source program at every time during execution.
The target program executes independently and does not require the compiler in the memory.The interpreter exists in the memory during interpretation.
Difficult to implement as compilers cannot predict what happens at turn time.It is best suited for the program and development environment.
It takes an entire program as an input.It takes a single line of coding as an input.
Display all errors after compilation, all at the same time.Displays all errors of each line one by one.

25) What is a programming language?

A programming language is a collection of grammar rules to instruct computers or computing devices to perform tasks.


26) What is inheritance?

Inheritance is an object-oriented programming concept in which one class derives the properties of the rest of the classes.


27) Distinguish between constructor and method

The difference between a constructor and a method is:

ConstructorMethod
Constructor is used for initializing the instance of any class.Method is used to perform some operation or function.
It does not have any return typeIt has a return type.
The constructor name must be the same as a class name.The name of the method can be the same or different as per need.
It calls automatically when you create a class object.You need to call the method explicitly.
There is a default constructor which is provided by the compiler.There is no method provided by the compiler.

28) What is a byte stream?

The byte stream is most usually used to perform input and output for Unicode having 8 bits.


29) What do you mean by destructor?

Destructor is a class member function that deletes or destructs an object.


 

30) What are programming paradigms?

collection of guidelines, concepts, and standards that specify how computer code should be produced is referred to as the programming paradigm. 
Programming paradigms are method for categorizing programming languages according to their characteristics.