Skip to main content

Interview Questions for Computer Science Students

23 replies [Last post]
Faraz (not verified)
Some Answers
I will try to answer the networking questions.. and plz note that since these are supposed to be interview questions, hence I will answer in a format that is most common for interviews... i.e. wont give bookish explanation, but answer in a to the point way;

1. User(s) are complaining of delays when using the network. What would you do?
Ans: a lot of things, but will start with checking the broadcast, if any on the network.. and if the hub/switch is overburdened
2. What are some of the problems associated with operating a switched LAN?
Ans: single broadcast domain
3. Name some of the ways of combining TCP/IP traffic and SNA traffic over the same link.
Ans: use a gateway
4. What sort of cabling is suitable for Fast Ethernet protocols?
Ans: cat6, 5e, shielded twisted pair
5. What is a Class D IP address?
Ans: special class used for multi cast
6. Why do I sometimes lose a server's address when using more than one server?
Ans: question not clear.. lose in what way?
7. What is Firewall?
Ans: a device (application) of securing internal network from external threats
8. How do I monitor the activity of sockets?
Ans: some network/packet monitor
9. How would I put my socket in non-blocking mode?
10. What are RAW sockets?
11. What is the role of TCP protocol and IP protocol.
Ans: TCP = layer 4, used for packet transfer... IP=layer 3, an addressing method
12. What is UDP?
Ans: a connectionless packet transfer protocol.. unguaranteed but fast
13. How can I make my server a daemon?
Ans: need more elaboration.. simple answer: by configuration
14. How should I choose a port number for my server?
Ans: question not clear:.. ports are selected for services.. not servers usually
15. Layers in TCP/IP
Ans: Application, transport, internet, physical
16. How can I be sure that a UDP message is received?
Ans: you can't
17. How to get IP header of a UDP message
Ans: its the 20 bytes following the 8 bytes UDP header 
18. Writing UDP/SOCK_DGRAM applications
Ans: yeah.. thats an interesting subject :)
19. How many bytes in an IPX network address?
Ans: sorry, I have never worked with IPX.. worked briefly with Novell in the early days.. but nothing serious
20. What is the difference between MUTEX and Semaphore?
21. What is priority inversion?
22. Different Solutions to dining philosophers problem.
23. What is a message queue?
24. Questions on Shared Memory.
25. What is DHCP?
Ans: a service used to allot IP addresses to clients automatically.
26. Working of ping, telnet, gopher.
Ans: yes i have worked with them :).. ask anything about them
27. Can I connect two computers to internet using same line ?
Ans: Yes.. use the line on one computer and share the connection for the other one.
28. Q: What is TCP? What's the difference between TCP and UDP?
Ans: TCP is connection oriented.. UDP is connection less.. TCP is slow.. UDP fast.. TCP is guaranteed.. UDP is not.
29 Q: Explain how a TCP connection gets setup and torn down
30 Q: What is HTTP?
Ans: a protocol used for web browsing and  transferring HTML
Q: What is an HTTP Cookie?
Ans: HTTP or HTML ?? Well html cookie in layman's terms is some information stored as a file associated witha a particular webpage.. that helps the computer remember certain things when the user returns to that webpage
32 Q: Explain the OSI 7 layer model.
Ans: Explain: well its a long explanation.. are you sure you need that in an interview..
33 Q: How many IP addresses are in a /17 (CIDR notation)? What is the subnet mask for a /17 network? What is the broadcast? How many addresses are usable?
Ans: 32768,,  the last address is broadcast.. all but two are usable
34 Q: How do hostnames get translated into IP addresses? How do IP addresses get translated into MAC addresses?
Ans: hostnames->IP thru DNS or host file.. ipaddress -->MAC thru ARP
35... Q: What does "ping" do?
Ans: check connection status and response time of the other host
36 Q: How does a trace route program work
Ans: goes thru next hops to reach a certain destination and let us know the response time/delay between them
sanjeev's picture
Joined: 21 Feb 2011
Thanks Faraz
It will be of great help to the enginerring students, who are preparing for interviews.
Although its very short but hint is enough for hard working students to find out the answer in details :D

Keep it up Faraz

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Abhinav Arvind (not verified)
Reply to DBMS questions Part1
2. What is denormalization and when would you go for it?
Ans:: It is the reverse of normalization and it is best used when we need to join several heavy tables.
Its better to get the records from 1 table having redundant data in those cases so that the cost would be less.
3. How do you implement one-to-one, one-to-many and many-to-many relationships while designing tables?
Ans: One to one::- Join by primamry keys
One to many : Foreign key reference
Many to Many : Merge Join Cartesian which can be avoided by using some unique keys
4. What's the difference between a primary key and a unique key?
Ans: Primary key is clustured Index and does'nt allow NULL
5. What are user defined datatypes and when you should go for them?
Ans :
6. What is bit datatype and what's the information that can be stored inside a bit column?
Ans:After SqL Server 7.0 0,1 and NULL
7. Define candidate key, alternate key, composite key.
A candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys.
A key formed by combining at least two or more columns is called composite key.

8. What are defaults? Is there a column to which a default can't be bound?
Default values for a column , not apllicable to alternate and Candidate Keys.
9. What are the different types of joins?
Join match/combine two or more tables from a database. It means, combining rows or fields of two or more tables matching the common values. There are various types of joins which are as follows: 
a) Self Join: joining table with it's own record to extract unique record (one employee is manager of other two employee)
b) Inner Join
  i) Equi Join:No difference with inner join (just write join instead of inner join)
 ii) Cross Join: will get you result each row of first table with each row of the other table(i.e. select * from employee cross join salary)
c) Outer Join
  i) Left Outer Join:joins the matching records from two tables and all the records from left side of the table and those unmatched records have null value in right side of the table.
 ii) Right Outer Join:joins the matching records from two tables and all the records from right side of the table and those unmatched records have null value in left side of the table. 
iii) Full Outer Join: Regardless of matching record of both side of the tables, it produce all the records of both the table and produce NULL values for every column of the table that lacks of matching row.
10. Explain normalization with examples.
See Prashant's link ..
11. What cursor type do you use to retrieve multiple recordsets?
Ans: Explicit cursors
12. Diffrence between a "where" clause and a "having" clause
Ans: Where is used before group by cluase tas filter condition  and having is used after you have done the group by clause and aggregated the values.
13. What is the difference between "procedure" and "function"?
Ans : Function has to Return something in all the cases while procedure may or may not.
14. How will you copy the structure of a table without copying the data?
create table table_1 as Select * from table where 1=2 ;
15. How to find out the database name from SQL*PLUS command prompt?
Ans :Select * from v$database;
16. Tradeoffs with having indexes
Ans 1. Faster selects, slower updates. 2. Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index.
17. Talk about "Exception Handling" in PL/SQL?
18. What is the diference between "NULL in C" and "NULL in Oracle?"
You can not use comparative operators for NULL in oracle, have to use Logical operators as IS nULL, IS not null
19. What is Pro*C? What is OCI?
The Pro* c/C++ precompiler takes the SQL statement that embeded in C/C++ code convert into standard C/C++  cod
e . when succefully precompile this code ,the result is a C or C++ programe that we compile and used to build the application that access the Oracle Application

OCI :- OCI refere to Oracle Call interface is set of Low Lavel API(Applcation Program Interface Call) used to intract with Oracle Database. By OCI one can use the operation such as Logon,Fatch,parse ,excute etc. Generally these are written in C/C++.
20. Give some examples of Analytical functions.
Row_NUmber, Rank,dense rank, lead,lag
21. What is the difference between "translate" and "replace"?
Translate replaces the characters bit by bit in the sequential order while replace replaces the string

Abhinav Arvind (not verified)
Reply to DBMS questions Part2
22. What is DYNAMIC SQL method 4?
23. How to remove duplicate records from a table?
delete from table_1
where rowid not in( select max(rowid) rid from table_1);
24. What is the use of ANALYZing the tables?
Ans:: So that Oracle database would know on how much volume its working and thus it would  optimize the query using its execution plan 
25. How to run SQL script from a Unix Shell?
connect <username>/<password>
select * from dual;
26. What is a "transaction"? Why are they necessary?
Ans : A transaction is a group of operations combined into a logical unit of work. Developer uses transactions to control and maintain the consistency and integrity of each action in a transaction, despite errors that might occur in the system
27. Explain Normalization and Denormalization with examples.
Ans: Redundant question
28. When do you get constraint violtaion? What are the types of constraints?
Ans: In not nullable filed you put Null,
in primary key  or Unique key you put duplicate records,
you put null in primary key.
you delete records in parent table while foreign key constraint is active on child
29. How to convert RAW datatype into TEXT?
Ans :select raw_datatype from table will return it as text.
30. Difference - Primary Key and Aggregate Key
Ans:A primary key consists of more than one column. Also known as a concatenated key or Aggregate Key. it is also called as composite key.
A primary key consists of more than one column. Also known as a concatenated key or Aggregate Key. it is also called as composite key.
31. How functional dependency is related to database table design?
Ans:: Read 2NF
32. What is a "trigger"?
33. Why can a "group by" or "order by" clause be expensive to process?
ans:Group by: It clubs all the similar rows and display only the distinct data so here clubing and displaying distinct data is an overhead.

Order by: It sorts the data either in ascending order or in desending order as specified in the query. Sorting the data is an overhead.
34. What are "HINTS"? What is "index covering" of a query?
Hints are used to optimize the sql queries from what their execution plan is created by oracle database engine.
index covering" of a query means when all the columns used in the select and where clause are used as an index to boost up the performance as data that we need to fetch will be directly picked up by covered index.
35. What is a VIEW? How to get script for a view?
Ans:Virtual recordset created by joining multiple tables and using the required columns of them all.
36. What are the Large object types suported by Oracle?
37. What is SQL*Loader?
Ans :Its used to insert data into tables either in append mode or truncate mode.
38. Difference between variable character datatypes


Data Type Maximum Size in PL/SQL Maximum Size in SQL


32,767 bytes

2,000 bytes


32,767 bytes

2,000 bytes


32,767 bytes

2,000 bytes


32,767 bytes

4,000 bytes


32,767 bytes

4,000 bytes


32,760 bytes

2 gigabytes (GB) - 1


32,760 bytes

2 GB


128 terabytes (TB)

(4 GB - 1) * <span class="codeinlineitalic">database_block_size</span>


128 TB

(4 GB - 1) * <span class="codeinlineitalic">database_block_size</span>


128 TB

(4 GB - 1) * <span class="codeinlineitalic">database_block_size</span>

39. What is the difference among "dropping a table", "truncating a table" and "deleting all records" from a table.
Ans: dropping drobs the table and sends to recyclebin with its data.
Truncate: removes the address  pointers and the data becomes inaccesible while the data becomes junk
Delete: it removes data from each address location
40. Difference between "ORACLE" and "MICROSOFT ACCESS" databases.
Oracle is ORDBMS (Object Oriented Relational DataBase) while Access is RDBMS(Relational DataBase) only.
41. How to create a database link ?
create public database link
connect to
identified by
using 'tns_service_name'

42. What is RAID and what are different types of RAID configurations?
43. What are the steps you will take to improve performance of a poor performing query?
Add index to it,
Analyze the table
if in execution plan it doesnt work properly then give hints to optimize the query
44. What is a deadlock and what is a live lock? How will you go about resolving deadlocks?
45. What are the steps you will take, if you are tasked with securing an SQL Server?
 Preferring NT authentication
• Using server database and application to control the access
• Securing the physical database by using NTFS permission
• Remaining the Administrator account on the SQL Server computer
• Disabling the Guest account
• Enabling modifying function
• Setting up firewall
• Using multi-protocol encryption
• Isolating SQL server from web server
46. What is blocking and how would you troubleshoot it?
47. Explain CREATE DATABASE syntax
48. How to restart SQL Server in single user mode? How to start SQL Server in minimal configuration mode?
SQL Server can be started from command line, using the SQLSERVR.EXE. This EXE has some very important parameters with which a DBA should be familiar with. -m is used for starting SQL Server in single user mode and -f is used to start the SQL Server in minimal confuguration mode. Check out SQL Server books online for more parameters and their explanations.
49. As a part of your job, what are the DBCC commands that you commonly use for database maintenance?




50. What are statistics, under what circumstances they go out of date, how do you update them?





: Statistics determine the selectivity of the indexes. If an indexed column

has unique values then the selectivity of that index is more, as opposed to an index

with non-unique values. Query optimizer uses these indexes in determining whether

to choose an index or not while executing a query.

Guess what!!! I got a better link for these questions ::

Sama (not verified)
Answers to operating system questions
1. What are the basic functions of an operating system?
An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. The operating system is a vital component of the system software in a computer system. Application programs usually require an operating system to function.
The basic functions of an operating system are:
  • Booting the computer
  • Performs basic computer tasks eg managing the various peripheral devices eg mouse, keyboard
  • Provides a user interface, e.g. command line, graphical user interface (GUI)
  • Handles system resources such as computer's memory and sharing of the central processing unit (CPU) time by various applications or peripheral devices
  • Provides file management which refers to the way that the operating system manipulates, stores, retrieves and saves data.
2. Explain briefly about, processor, assembler, compiler, loader, linker and the functions executed by them.
  • Processor:--A processor is the part a computer system that executes instructions .It is also called a CPU
  • Assembler: -- converts the assembly level language code to object code that is executable file that needs to be linked with libraries and loaded into memory for execution
  • Compiler: --- Converts high level language code to assembly level language code
  • Loader:-- loads the executable code into memory for execution
  • Linker: -- Linker performs the linking of libraries with the object code to make the object code into an executable machine code.
3. What are the difference phases of software development? Explain briefly?
  • Requirement
  • Design
  • Implementation
  • Verification
  • Maintenance
4. Differentiate between RAM and ROM?
  • RAM is Random Access Memory, while ROM stands for Read Only Memory.
  • RAM is volatile and is erased when the computer is switched off. ROM is non-volatile and generally cannot be written to. • RAM is used for both read and write while ROM is used only for reading. • RAM needs electricity to flow to retain information while ROM is permanent.
  • RAM is analogous to a blackboard on which information can be written with a chalk and erased any number of times, while ROM is permanent and can only be read. One example is BIOS (basic input output system) that runs when computer is switched on and it prepares disk drives and processor to load OS from disk.
5. What is DRAM?
In which form does it store data? DRAM is the Hershey's chocolate of readable/writable memory: it's not the best, but it's cheap, does the job, and is available almost everywhere you look. DRAM data resides in a cell made of a capacitor and a transistor. The capacitor tends to lose data unless it's recharged every couple of milliseconds, and this recharging tends to slow down the performance of DRAM compared to speedier RAM types.

6. What is cache memory?
The Cache Memory is the Memory which is very nearest to the CPU , all the Recent Instructions are Stored into the Cache Memory. The Cache Memory is attached for storing the input which is given by the user and which is necessary for the CPU to Perform a Task. But the Capacity of the Cache Memory is too low in compare to Memory and Hard Disk.

7. What is hard disk and what is its purpose?
Hard disk is the secondary storage device, which holds the data in bulk, and it holds the data on the magnetic medium of the disk.Hard disks have a hard platter that holds the magnetic medium, the magnetic medium can be easily erased and rewritten, and a typical desktop machine will have a hard disk with a capacity of between 10 and 40 gigabytes. Data is stored onto the disk in the form of files.

8. Differentiate between Compiler and Interpreter?
Compiler translates the high level instruction into machine language, but the interpreter translates the high level instruction into an intermediate code.  The compiler executes the entire program at a time, but the interpreter executes each and every line individually. Compiler reports the list of errors that are caused during the process of execution, but the interpreter quits translating soon after finding an error, the progression of the other lines of the program will be done after refining the error.  Autonomous executable file is generated by the compiler while interpreter is compulsory for an interpreter program.

9. What are the different tasks of Lexical analysis?
The main task of lexical anlyzer is to form token.It takes source code as input & begin scanning from left to right & form token which are enter in the symbol table to generate parse tree during compilation.So lexical anlyzer is the first part of compilation.

10. What are the different functions of Syntax phase, Scheduler?
Syntax phase deals with the problem of deciding which of the process in ready queue.
Syntax phase scheduler deals with the problem of deciding which of the process in ready queue is to allocate the CPU time for processing.

11. What are the main difference between Micro-Controller and Micro- Processor?
Micro Processor with memory and other peripherals is called as a Micro controller. One of the main differences is that microcontrollers are usually designed to perform a small set of specific functions, for example as in the case of a Digital Signal Processor which performs a small set of signal processing functions, whereas microprocessors tend to be designed to perform a wider set of general purpose functions.

12. Describe different job scheduling in operating systems.
Job scheduling schedules or decides which process will get to acquire the resource based on some parameters. FIFO- The process that comes first is executed first. Shortest job First- The time taken to complete the job of all processes is computed and the shortest length process is executed first. Round Robin- Each process gets a time “share” for running and is later prevented to get the next process running. Priority scheduling- here, the process on highest priority gets the resource.

13. What is a Real-Time System?
A real-time system is one that must process information and produce a response within a specified time, else risk severe consequences, including failure. That is, in a system with a real-time constraint it is no good to have the correct action or the correct answer after a certain deadline: it is either by the deadline or it is useless!

14. What is the difference between Hard and Soft real-time systems?
Hard real time systems are systems that cant tolerate any delay or if delay happens the whole system will be worthless soft real time systems are systems that can tolerate delay example for hard are break systems in automotives examples for soft are mp3 players or mobiles

15. What is a mission critical system?
A mission critical system is a system that is essential to the survival of a business or organization. When a mission critical system fails or is interrupted, business operations are significantly impacted.

16. What is the important aspect of a real-time system?
Determinism & predictable output within a specified time-interval is the most important aspect of a real-time system.

17. If two processes which shares same system memory and system clock in a distributed system, What is it called?
Symmetric Multiprocessing (SMP)

18. What is the state of the processor, when a process is waiting for some event to occur?
Waiting state

19. What do you mean by deadlock?
Deadlock is a situation in which the processes waits for the other resource which is occupied by another process in a loop for example take processes P1 and P2 and resources R1 and R2 in the deadlock condition P1 -R1 waits for R2 P2 -R2 waits for R1 so both processes waits for the other resource to get free for their complete operation.
In such cases - One can avoid deadlocks by following methods
1) Prevention
2) Detection
3) Avoidance
4) Recovery

20. Explain the difference between microkernel and macro kernel. Give an example of microkernel.
Micro-Kernel: A micro-kernel is a minimal operating system that performs only the essential functions of an operating system. All other operating system functions are performed by system processes.
Monolithic: A monolithic operating system is one where all operating system code is in a single executable image and all operating system code runs in system mode.

21. When would you choose bottom up methodology?
Bottom-up methodology is used when problem is very complex and we can divide a large problem into many small problems. Bottom up approach is used in c++ down is used in c.

22. When would you choose top down methodology?
Top down approach is preferred when understanding of the complete system is done. Sufficient knowledge of the system is required.

23. Why paging is used?
Paging is solution to external fragmentation problem which is to permit the logical address space of a process to be noncontiguous, thus allowing a process to be allocating physical memory wherever the latter is available. Paging is a memory management technique in which the memory is divided into fixed size pages. Paging is used for faster access to data. When a program needs a page, it is available in the main memory as the OS copies a certain number of pages from your storage device to main memory. Paging allows the physical address space of a process to be noncontiguous.

24. Which is the best page replacement algorithm and Why? How much time is spent usually in each phases and why?
The criteria for the best page replacement algorithm are as follows:
1. It should be good to predict which page would not be necessary for the maximum amount of time, so it can be chosen as a victim and exchanged on the disc.
2. It should use minimal resources (in terms of computation and memory) to identify the victim.

25. Difference between Primary storage and secondary storage?
Primary storage can be referred as RAM it is volatile memory and fast accessing memory this is used for executing instructions it stores the data as long as power is supplied...
Secondary storage which stores the data independent of power supply it is permenent storage example : hard disk , floppy disk, Compact disk.

26. What is multi tasking, multi programming, multi threading?
Multiprogramming is the technique of running several programs at a time using timesharing. It allows a computer to do several things at the same time. Multiprogramming creates logical parallelism. The concept of multiprogramming is that the operating system keeps several jobs in memory simultaneously. The operating system selects a job from the job pool and starts executing a job, when that job needs to wait for any i/o operations the CPU is switched to another job. So the main idea here is that the CPU is never idle.

Multi tasking: Multitasking is the logical extension of multiprogramming .The concept of multitasking is quite similar to multiprogramming but difference is that the switching between jobs occurs so frequently that the users can interact with each program while it is running. This concept is also known as time-sharing systems. A time-shared operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of time-shared system.

Multi threading: An application typically is implemented as a separate process with several threads of control. In some situations a single application may be required to perform several similar tasks for example a web server accepts client requests for web pages, images, sound, and so forth. A busy web server may have several of clients concurrently accessing it. If the web server ran as a traditional single-threaded process, it would be able to service only one client at a time. The amount of time that a client might have to wait for its request to be serviced could be enormous.

So it is efficient to have one process that contains multiple threads to serve the same purpose. This approach would multithread the web-server process, the server would create a separate thread that would listen for client requests when a request was made rather than creating another process it would create another thread to service the request. To get the advantages like responsiveness, Resource sharing economy and utilization of multiprocessor architectures multithreading concept can be used.

27. Explain about paged segmentation and segment paging
PAGING: Paging memory allocation algorithms divide computer memory into small partitions, and allocates memory using a page as the smallest building block.
SEGMENTAION: Segmentation means that a part or parts of the memory will be sealed off from the currently running process, through the use of hardware registers. If the data that is about to be read or written to is outside the permitted address space of that process, a segmentation fault will result.
angkita (not verified)
i need answers too
sanjeev's picture
Joined: 21 Feb 2011
Please go through each comments to check the answers.
We are trying to post answers whenever we get time. You can see answers posted by many users for different subjects like OS, DBMS, Networking etc.

Please go through each comments to check the answers.

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

sanjeev's picture
Joined: 21 Feb 2011
Go through the comments you will find the answers also
Go through the comments you will find the answers also contributed by our readers :)

Follow us at :
Facebook | Twitter
########### Give me the right place to stand, I shall move the earth. #################

Anonymous (not verified)
For Latest Computer Science
For Latest Computer Science Engineering Interview Questions and answers pdf goto:
meena (not verified)
tanq ....................sir
tanq ....................sir
can u suggest best  websites to learn C source code

Post new comment

The content of this field is kept private and will not be shown publicly.
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Enter the characters shown in the image.