7
Most read
8
Most read
9
Most read
CONCEPTS PROBLEMS INTERVIEW QUESTIONS
IT Interview
Questions
By
Narasimha Karumanchi
A Primer For The IT Job Interviews
Copyright ©2014 CareerMonk Publications. All rights reserved.
All rights reserved. No part of this book may be reproduced in any form or by any
electronic or mechanical means, including information storage and retrieval systems,
without written permission from the publisher or author.
Copyright ©2014 by
𝐶𝑎𝑟𝑒𝑒𝑟𝑀𝑜𝑛𝑘 𝑃𝑢𝑏𝑙𝑖𝑐𝑎𝑡𝑖𝑜𝑛𝑠
All rights reserved.
Designed by 𝑁𝑎𝑟𝑎𝑠𝑖𝑚ℎ𝑎 𝐾𝑎𝑟𝑢𝑚𝑎𝑛𝑐ℎ𝑖
Acknowledgements
ℎ and ℎ , it is impossible to thank you adequately for everything you have
done, from loving me unconditionally to raising me in a stable household, where you
persistent efforts traditional values and taught your children to celebrate and embrace
life. I could not have asked for better parents or role-models. You showed me that
anything is possible with faith, hard work and determination.
This book would not have been possible without the help of many people. I would like to
thank them for their efforts in improving the end result. Before we do so, however, I
should mention that I have done my best to correct the mistakes that the reviewers
have pointed out and to accurately describe the protocols and mechanisms. I alone am
responsible for any remaining errors.
First and foremost, I would like to express my gratitude to many people who saw me
through this book, to all those who provided support, talked things over, read, wrote,
offered comments, allowed me to quote their remarks and assisted in the editing,
proofreading and design. In particular, I would like to thank the following individuals.
 ℎ , IIT Bombay, Architect, dataRPM Pvt. Ltd.
 , Senior Consultant, Juniper Networks Pvt. Ltd.
 ℎ ℎ , IIT Kanpur, Mentor Graphics Pvt. Ltd.
 , IISc, Bangalore
 ℎ , Yahoo India Pvt. Ltd.
 ℎ , Development Manager, IBM Software Labs
 ℎ , - ℎ., , Subjects.
 ℎ B-Tech., Technical Lead, HCL
 ℎ, Head Master, Obulasuni Palle, Z. P. H. School
 , Teacher, Kambhampadu, Z. P. H. School
 ℎ , Teacher, Durgi
 ℎ ℎ , Founder, StockMonks Pvt. Ltd.
 , Co-Founder, NotionPress Pvt. Ltd.
 ℎ, Lecturer, Nagarjuna Institute of Technology and Sciences, MLG
-𝑁𝑎𝑟𝑎𝑠𝑖𝑚ℎ𝑎 𝐾𝑎𝑟𝑢𝑚𝑎𝑛𝑐ℎ𝑖
M. Tech, 𝐼𝐼𝑇 𝐵𝑜𝑚𝑏𝑎𝑦
Founder, 𝐶𝑎𝑟𝑒𝑒𝑟𝑀𝑜𝑛𝑘 𝑐𝑜𝑚
It interview questions
Preface
Dear Reader,
Please Hold on! I know many people do not read the preface. But I would strongly
recommend that you go through the preface of this book at least.
India has many of the key ingredients for making this transition. It has a critical mass
of skilled, English-speaking knowledge workers, especially in the sciences. It has a well-
functioning democracy. Its domestic market is one of the world’s largest. It has a large
and impressive scattering, creating valuable knowledge linkages and networks. In
addition, the development of the IT sector in recent years has been remarkable. India
has created profitable niches in information technology (IT) and is becoming a global
provider of software services.
Many software companies hire graduates with different back-grounds computer science,
electrical, civil, mechanical, B.E., B. Tech., MCAs, MBAs etc. The year 2013-14
characterizes a landmark year as aggregate revenue for the Indian IT-BPO sector is
estimated to cross USD 120 billion.
India currently produces a solid core of knowledge workers in tertiary and scientific and
technical education, although the country needs to do more to create a larger cadre of
educated and agile workers who can adapt and use knowledge. Efforts have been put
into establishing a top-quality university system that includes many world-class
institutions of higher learning that are competitive and meritocratic, such as Indian
Institutes of Technology (IITs), Indian Institutes of Management, Indian Institute of
Science, and the National Institute of Technology (NITs). Despite these efforts, not all
publicly funded universities or other educational institutions in India have been able to
maintain high-quality standards or keep pace with developments in knowledge and
technology.
IT Interview Questions try to facilitate pupils who arrive from colleges where they could
not find proper assistance for career counselling.
There are hundreds of books on IT interviews already flooding the market. You may
naturally wonder what the need of writing another book on IT interviews is! This book
assumes you have basic knowledge about computer science. Main objective of the book
is to provide you the of and ℎ Before
writing the book, I set myself the following :
 The book be written in ℎ that students from non-IT branches should
be able to understand it and .
 The book should present the concepts in and straightforward manner
with a explanation.
 The book should provide enough examples so that students get better
understanding of the and also useful for the / -
interviews.
 It should challenge you to look at the small but signifcant changes you need to
make to improve your impact at interviews.
 In this book you will learn all the secrets you need to know to help nail your job
interview and get the job.
Please remember, the books which are available in the market are lacking one or many
of these goals. This book is different from other books available on the market. The
main goals of this book are to provide students with a good knowledge base, and to
offer a better understanding to those new to IT. Based on my experience, I thought of
writing this book aiming at achieving these goals in a simple way. A 3-stage formula is
used in writing this book, i.e.
+ +
I used very simple language such that a school going student can also understand the
concepts easily. Once the concept is discussed, it is then interlaced into problems. The
solutions of each and every problem are well explained. Finally, interview questions
with answers on every concept are covered. All the interview questions in this book are
collected from various interviews conducted by top software development companies.
Interviewing is all about research, confidence and creating a good rapport. Everyone is
nervous on interviews. If you simply allow yourself to feel nervous, you'll do much
better. Remember also that it's difficult for the interviewer as well. In general, be upbeat
and positive. Never be negative. As a job seeker if you read complete book with good
understanding, I am sure you will challenge the interviewers and that is the objective of
this book.
It is that, at least reading of this book is required to get full
understanding of all the topics. In the readings, you can directly go to any
chapter and refer. Even though, enough readings were given for correcting the errors,
due to human tendency there could be some minor typos in the book. If any such typos
found, they will be updated at . . I request you to constantly monitor this
site for any corrections, new problems and solutions. Also, please provide your valuable
suggestions at: .
Wish you all the best. I are sure that you will find this book useful.
-𝑁𝑎𝑟𝑎𝑠𝑖𝑚ℎ𝑎 𝐾𝑎𝑟𝑢𝑚𝑎𝑛𝑐ℎ𝑖
M. Tech, 𝐼𝐼𝑇 𝐵𝑜𝑚𝑏𝑎𝑦
Founder, 𝐶𝑎𝑟𝑒𝑒𝑟𝑀𝑜𝑛𝑘 𝑐𝑜𝑚
Table of Contents
1. Organization of Chapters-----------------------------------------------------------17
1.1 Why Separate Book on IT Interviews? -------------------------------------------------- 17
1.2 What Is this Book About?----------------------------------------------------------------- 17
1.3 Should I Take this Book? ----------------------------------------------------------------- 18
1.4 Organization of Chapters ----------------------------------------------------------------- 18
2. Getting Ready ------------------------------------------------------------------------22
2.1 Best Ways To Get An Interview Call ----------------------------------------------------- 22
2.2 Reasons Why You Are Not Getting Interview Calls------------------------------------ 23
2.3 Does Your GPA (or Percentage) Really Matter? ---------------------------------------- 25
2.4 Hot Tips On Resume Writing ------------------------------------------------------------- 27
2.5 Designing The Resume -------------------------------------------------------------------- 32
2.6 Sample Resume ---------------------------------------------------------------------------- 34
3. Group Discussions ------------------------------------------------------------------37
3.1 What is Group Discussion?--------------------------------------------------------------- 37
3.2 Group Discussions in Interviews -------------------------------------------------------- 37
3.3 Group Discussions at Universities/Colleges------------------------------------------- 38
3.4 How to Face Group Discussion in Interviews?----------------------------------------- 38
3.5 Points to Remember ----------------------------------------------------------------------- 40
3.6 Tips for Group Discussion ---------------------------------------------------------------- 41
3.7 Do’s of a Group Discussion--------------------------------------------------------------- 43
3.8 Topics for Practicing Group DIscussions ----------------------------------------------- 44
3.9 Mock Group Discussions ----------------------------------------------------------------- 46
4. Operating System Concepts--------------------------------------------------------54
4.1 What is an Operating System? ----------------------------------------------------------- 54
4.2 Types of Operating Systems -------------------------------------------------------------- 54
4.3 Memory Management---------------------------------------------------------------------- 55
4.4 What is Job Scheduling and a Process? ------------------------------------------------ 60
4.5 Processor Scheduling Algorithms-------------------------------------------------------- 62
4.6 Process Synchronization ------------------------------------------------------------------ 63
4.7 Interprocess Communication [IPC] ------------------------------------------------------ 66
4.8 Starvation and Aging ---------------------------------------------------------------------- 70
4.9 Complier and Interpreter------------------------------------------------------------------ 71
4.10 Process Loading and Linking ----------------------------------------------------------- 71
Problems and Questions with Answers------------------------------------------------------ 74
5. C/C++/Java Interview Questions ------------------------------------------------ 81
5.1 Variables------------------------------------------------------------------------------------- 81
5.2 Data types ----------------------------------------------------------------------------------- 81
5.3 Data Structure------------------------------------------------------------------------------ 82
5.4 Abstract Data Types (ADTs) -------------------------------------------------------------- 82
5.5 Memory and Variables--------------------------------------------------------------------- 83
5.6 Pointers -------------------------------------------------------------------------------------- 84
5.7 Techniques of Parameter Passing-------------------------------------------------------- 87
5.8 Binding -------------------------------------------------------------------------------------- 90
5.9 Scope----------------------------------------------------------------------------------------- 91
5.10 Storage Classes --------------------------------------------------------------------------- 93
5.11 Storage Organization--------------------------------------------------------------------- 97
5.12 Programming Techniques --------------------------------------------------------------- 99
5.13 Basic Concepts of OOPS----------------------------------------------------------------101
Problems and Questions with Answers-----------------------------------------------------105
6. Scripting Languages ---------------------------------------------------------------157
6.1 Interpreter versus Compiler -------------------------------------------------------------157
6.2 What Are Scripting Languages?---------------------------------------------------------158
6.3 Shell Scripting -----------------------------------------------------------------------------158
6.4 PERL [Practical Extraction and Report Language] -----------------------------------166
6.5 Python --------------------------------------------------------------------------------------188
7. Bitwise Hacking --------------------------------------------------------------------194
7.1 Introduction--------------------------------------------------------------------------------194
7.1 Hacks on Bitwise Programming---------------------------------------------------------194
Problems and Questions with Answers-----------------------------------------------------198
8. Concepts of Computer Networking----------------------------------------------203
8.1 What is a Computer Network? ----------------------------------------------------------203
8.2 Basic Elements of Computer Networks ------------------------------------------------203
8.3 What is an Internet? ----------------------------------------------------------------------204
8.4 Fundamentals of Data and Signals-----------------------------------------------------204
8.5 Network Topologies -----------------------------------------------------------------------207
8.6 Network Operating Systems -------------------------------------------------------------211
8.7 Transmission Medium--------------------------------------------------------------------212
8.8 Types of Networks-------------------------------------------------------------------------214
8.9 Connection-oriented and Connectionless services -----------------------------------217
8.10 Segmentation and Multiplexing -------------------------------------------------------218
8.11 Network Performance -------------------------------------------------------------------218
8.12 Network Switching-----------------------------------------------------------------------222
8.13 Why OSI Model? -------------------------------------------------------------------------229
8.14 What is a Protocol-Stack? --------------------------------------------------------------229
8.15 OSI Model---------------------------------------------------------------------------------229
8.16 TCP/IP Model-----------------------------------------------------------------------------234
8.17 Difference between OSI and TCP/IP models-----------------------------------------236
8.18 How does TCP/IP Model (Internet) work? --------------------------------------------237
8.19 Understanding Ports --------------------------------------------------------------------239
8.20 Hypertext Transfer Protocol [HTTP] ---------------------------------------------------240
8.21 Simple Mail Transfer Protocol [SNMP]------------------------------------------------243
8.22 File Transfer Protocol [FTP] ------------------------------------------------------------244
8.23 Domain Name Server [DNS]------------------------------------------------------------245
8.24 Dynamic Host Configuration Protocol [DHCP] --------------------------------------250
8.25 How traceroute (or tracert) works?----------------------------------------------------252
8.26 How ping works?-------------------------------------------------------------------------253
8.27 What is QoS? -----------------------------------------------------------------------------253
8.28 Wireless Networking---------------------------------------------------------------------254
Problems and Questions with Answers-----------------------------------------------------255
9. Database Management Systems ------------------------------------------------ 256
9.1 What is a Database?----------------------------------------------------------------------256
9.2 Database Management System [DBMS] -----------------------------------------------256
9.3 Procedural and Non-Procedural --------------------------------------------------------257
9.4 What is SQL? ------------------------------------------------------------------------------257
9.5 Data Definition and Manipulation------------------------------------------------------257
9.6 What is RDBMS? --------------------------------------------------------------------------257
9.7 What is Table? -----------------------------------------------------------------------------257
9.8 What is Field?------------------------------------------------------------------------------257
9.9 What is Record or Row? ------------------------------------------------------------------258
9.10 What is Column? ------------------------------------------------------------------------258
9.11 What is NULL value? --------------------------------------------------------------------258
9.12 SQL Constraints -------------------------------------------------------------------------258
9.13 Data Integrity-----------------------------------------------------------------------------258
9.14 Database Keys ---------------------------------------------------------------------------259
9.15 Normalization ----------------------------------------------------------------------------259
9.16 Functional Dependencies---------------------------------------------------------------262
9.17 First Normal Form or 1NF--------------------------------------------------------------262
9.18 Second Normal Form or 2NF-----------------------------------------------------------263
9.19 Third Normal Form or 3NF-------------------------------------------------------------264
9.20 Other Normal Forms --------------------------------------------------------------------265
Problems and Questions with Answers-----------------------------------------------------265
10. Brain Teasers -----------------------------------------------------------------------271
Problems and Questions with Answers-----------------------------------------------------271
11. Algorithms Introduction ----------------------------------------------------------274
11.1 What is an Algorithm? ------------------------------------------------------------------274
11.2 Why Analysis of Algorithms?-----------------------------------------------------------274
11.3 Goal of Analysis of Algorithms---------------------------------------------------------274
11.4 What is Running Time Analysis?------------------------------------------------------275
11.5 How to Compare Algorithms?----------------------------------------------------------275
11.6 What is Rate of Growth?----------------------------------------------------------------275
11.7 Commonly used Rate of Growths -----------------------------------------------------275
11.8 Types of Analysis ------------------------------------------------------------------------276
11.9 Asymptotic Notation and Big-O Notation --------------------------------------------276
11.10 Why is it called Asymptotic Analysis? ----------------------------------------------278
11.11 Guidelines for Asymptotic Analysis -------------------------------------------------278
11.12 Amortized Analysis---------------------------------------------------------------------279
Problems and Questions with Answers-----------------------------------------------------280
12. Recursion and Backtracking -----------------------------------------------------285
12.1 Introduction ------------------------------------------------------------------------------285
12.2 What is Recursion?----------------------------------------------------------------------285
12.3 Why Recursion?--------------------------------------------------------------------------285
12.4 Format of a Recursive Function -------------------------------------------------------285
12.5 Recursion and Memory (Visualization) -----------------------------------------------286
12.6 Recursion versus Iteration -------------------------------------------------------------287
12.7 Notes on Recursion----------------------------------------------------------------------287
12.8 Example Algorithms of Recursion-----------------------------------------------------287
Problems and Questions with Answers-----------------------------------------------------288
12.9 What is Backtracking?------------------------------------------------------------------289
12.10 Example Algorithms of Backtracking -----------------------------------------------289
Problems and Questions with Answers-----------------------------------------------------289
13. Linked Lists -------------------------------------------------------------------------290
13.1 What is a Linked List? ------------------------------------------------------------------290
13.2 Linked Lists ADT-------------------------------------------------------------------------290
13.3 Why Linked Lists? -----------------------------------------------------------------------290
13.4 Arrays Overview--------------------------------------------------------------------------291
13.5 Linked Lists Versus Arrays and Dynamic Arrays-----------------------------------292
13.6 Singly Linked Lists ----------------------------------------------------------------------292
13.7 Doubly Linked Lists ---------------------------------------------------------------------297
13.8 Circular Linked Lists--------------------------------------------------------------------302
13.9 A Memory-Efficient Doubly Linked List ----------------------------------------------307
Problems and Questions with Answers-----------------------------------------------------308
14. Stacks-------------------------------------------------------------------------------- 322
14.1 What is a Stack?-------------------------------------------------------------------------322
14.2 How Stacks are used? ------------------------------------------------------------------322
14.3 Stack ADT---------------------------------------------------------------------------------323
14.4 Applications ------------------------------------------------------------------------------323
14.5 Implementation --------------------------------------------------------------------------323
14.6 Comparison of Implementations ------------------------------------------------------328
Problems and Questions with Answers-----------------------------------------------------328
15. Queues ------------------------------------------------------------------------------ 336
15.1 What is a Queue?------------------------------------------------------------------------336
15.2 How are Queues Used? -----------------------------------------------------------------336
15.3 Queue ADT -------------------------------------------------------------------------------336
15.4 Exceptions --------------------------------------------------------------------------------337
15.5 Applications ------------------------------------------------------------------------------337
15.6 Implementation --------------------------------------------------------------------------337
Problems and Questions with Answers-----------------------------------------------------343
16. Trees --------------------------------------------------------------------------------- 345
16.1 What is a Tree?---------------------------------------------------------------------------345
16.2 Glossary-----------------------------------------------------------------------------------345
16.3 Binary Trees ------------------------------------------------------------------------------346
16.4 Types of Binary Trees -------------------------------------------------------------------347
16.5 Properties of Binary Trees --------------------------------------------------------------348
16.6 Binary Tree Traversals ------------------------------------------------------------------349
Problems and Questions with Answers-----------------------------------------------------353
16.7 Generic Trees (N-ary Trees) ------------------------------------------------------------366
Problems and Questions with Answers-----------------------------------------------------368
16.8 Threaded Binary Tree Traversals------------------------------------------------------368
Problems and Questions with Answers-----------------------------------------------------374
16.9 Binary Search Trees (BSTs) ------------------------------------------------------------375
Problems and Questions with Answers-----------------------------------------------------381
16.10 Balanced Binary Search Trees -------------------------------------------------------386
16.11 AVL (Adelson-Velskii and Landis) Trees --------------------------------------------387
Problems and Questions with Answers-----------------------------------------------------394
17. Priority Queues and Heaps------------------------------------------------------- 397
17.1 What is a Priority Queue? --------------------------------------------------------------397
17.2 Priority Queue ADT----------------------------------------------------------------------397
17.3 Priority Queue Applications------------------------------------------------------------398
17.4 Heaps and Binary Heap ----------------------------------------------------------------398
17.5 Binary Heaps -----------------------------------------------------------------------------399
17.6 Heapsort ----------------------------------------------------------------------------------404
Problems and Questions with Answers-----------------------------------------------------405
18. Graph Algorithms ------------------------------------------------------------------407
18.1 Introduction ------------------------------------------------------------------------------407
18.2 Glossary-----------------------------------------------------------------------------------407
18.3 Applications of Graphs------------------------------------------------------------------410
18.4 Graph Representation ------------------------------------------------------------------410
18.5 Graph Traversals ------------------------------------------------------------------------413
18.6 Shortest Path Algorithms---------------------------------------------------------------416
19. Sorting -------------------------------------------------------------------------------417
19.1 What is Sorting? -------------------------------------------------------------------------417
19.2 Why is Sorting necessary? -------------------------------------------------------------417
19.3 Classification of Sorting Algorithms --------------------------------------------------417
19.4 Other Classifications --------------------------------------------------------------------418
19.5 Bubble sort -------------------------------------------------------------------------------418
19.6 Selection Sort-----------------------------------------------------------------------------419
19.7 Insertion sort -----------------------------------------------------------------------------420
19.8 Shell sort----------------------------------------------------------------------------------422
19.9 Merge sort---------------------------------------------------------------------------------423
19.10 Heapsort---------------------------------------------------------------------------------425
19.11 Quicksort--------------------------------------------------------------------------------425
19.12 Tree Sort---------------------------------------------------------------------------------428
19.13 Comparison of Sorting Algorithms --------------------------------------------------428
19.14 Linear Sorting Algorithms ------------------------------------------------------------428
19.15 Counting Sort---------------------------------------------------------------------------428
19.16 Bucket sort [or Bin Sort] --------------------------------------------------------------429
19.17 Radix sort -------------------------------------------------------------------------------430
19.18 External Sorting------------------------------------------------------------------------430
Problems and Questions with Answers-----------------------------------------------------431
20. Searching----------------------------------------------------------------------------441
20.1 What is Searching?----------------------------------------------------------------------441
20.2 Why do we need Searching? -----------------------------------------------------------441
20.3 Types of Searching ----------------------------------------------------------------------441
20.4 Unordered Linear Search---------------------------------------------------------------441
20.5 Sorted/Ordered Linear Search --------------------------------------------------------442
20.6 Binary Search ----------------------------------------------------------------------------442
20.7 Comparing Basic Searching Algorithms ---------------------------------------------443
Problems and Questions with Answers-----------------------------------------------------443
21. Hashing------------------------------------------------------------------------------ 466
21.1 What is Hashing?------------------------------------------------------------------------466
21.2 Why Hashing?----------------------------------------------------------------------------466
21.3 HashTable ADT --------------------------------------------------------------------------466
21.4 Understanding Hashing ----------------------------------------------------------------466
21.5 Components of Hashing ----------------------------------------------------------------468
21.6 Hash Table--------------------------------------------------------------------------------468
21.7 Hash Function ---------------------------------------------------------------------------468
21.8 Load Factor -------------------------------------------------------------------------------469
21.9 Collisions----------------------------------------------------------------------------------469
21.10 Collision Resolution Techniques-----------------------------------------------------469
21.11 Separate Chaining ---------------------------------------------------------------------469
21.12 Open Addressing -----------------------------------------------------------------------470
21.13 Comparison of Collision Resolution Techniques ----------------------------------471
21.14 How Hashing Gets O(1) Complexity?------------------------------------------------471
21.15 Hashing Techniques -------------------------------------------------------------------471
21.16 Problems for which Hash Tables are not suitable---------------------------------472
22. String Algorithms ------------------------------------------------------------------ 473
22.1 Introduction ------------------------------------------------------------------------------473
22.2 String Matching Algorithms------------------------------------------------------------473
22.3 Brute Force Method ---------------------------------------------------------------------474
22.4 Robin-Karp String Matching Algorithm ----------------------------------------------474
22.5 KMP Algorithm ---------------------------------------------------------------------------475
Problems and Questions with Answers-----------------------------------------------------478
23. Algorithms Design Techniques -------------------------------------------------- 480
23.1 Introduction ------------------------------------------------------------------------------480
23.2 Classification -----------------------------------------------------------------------------480
23.3 Classification by Implementation Method -------------------------------------------480
23.4 Classification by Design Method ------------------------------------------------------481
23.5 Other Classifications --------------------------------------------------------------------482
24. Greedy Algorithms ----------------------------------------------------------------- 483
24.1 Introduction ------------------------------------------------------------------------------483
24.2 Does Greedy Always Work? ------------------------------------------------------------483
24.3 Advantages and Disadvantages of Greedy Method ---------------------------------483
24.4 Greedy Applications ---------------------------------------------------------------------483
24.5 Understanding Greedy Technique ----------------------------------------------------484
25. Divide and Conquer Algorithms -------------------------------------------------487
25.1 Introduction ------------------------------------------------------------------------------487
25.2 What is Divide and Conquer Strategy?-----------------------------------------------487
25.3 Does Divide and Conquer Always Work? --------------------------------------------487
25.4 Divide and Conquer Visualization ----------------------------------------------------487
25.5 Understanding Divide and Conquer --------------------------------------------------488
25.6 Advantages of Divide and Conquer ---------------------------------------------------489
25.7 Disadvantages of Divide and Conquer------------------------------------------------489
25.8 Divide and Conquer Applications -----------------------------------------------------489
26. Dynamic Programming------------------------------------------------------------490
26.1 Introduction ------------------------------------------------------------------------------490
26.2 What is Dynamic Programming Strategy? -------------------------------------------490
26.3 Can Dynamic Programming Solve All Problems? -----------------------------------490
26.4 Examples of Dynamic Programming Algorithms------------------------------------490
26.5 Understanding Dynamic Programming ----------------------------------------------491
27. Basics of Design Patterns---------------------------------------------------------494
27.1 Brief History Of Design Patterns ------------------------------------------------------494
27.2 Why Design Patterns?-------------------------------------------------------------------494
27.3 Categories Of Design Patterns ---------------------------------------------------------494
27.4 What To Observe For A Design Pattern? ---------------------------------------------495
27.5 Using Patterns To Gain Experience---------------------------------------------------496
27.6 Can We Use Design Patterns Always? ------------------------------------------------496
27.7 Design Patterns vs. Frameworks ------------------------------------------------------497
27.8 Creational Design Patterns-------------------------------------------------------------497
27.9 Singleton Design Pattern ---------------------------------------------------------------498
27.10 Structural Design Patterns -----------------------------------------------------------501
27.11 Behavioral Design Patterns-----------------------------------------------------------502
28. Non-Technical Help----------------------------------------------------------------504
28.1 Tips ----------------------------------------------------------------------------------------504
Questions with Answers ----------------------------------------------------------------------505
29. Quantitative Aptitude Concepts -------------------------------------------------510
29.1 Formulas on Number Series -----------------------------------------------------------510
29.2 Tips on Divisibility Checks -------------------------------------------------------------510
29.3 Mathematical Formulas ----------------------------------------------------------------511
29.4 Ratios and Proportions -----------------------------------------------------------------511
29.5 Percentage --------------------------------------------------------------------------------511
29.6 Profit and Loss ---------------------------------------------------------------------------512
29.7 Volumes and Surface Areas------------------------------------------------------------512
29.8 Logarithms--------------------------------------------------------------------------------513
29.9 Formulae for Trains Problems ---------------------------------------------------------514
29.10 Indices -----------------------------------------------------------------------------------514
29.11 Surds-------------------------------------------------------------------------------------514
29.12 Clock -------------------------------------------------------------------------------------515
29.13 Blood Relations Tricks ----------------------------------------------------------------516
29.14 Probability-------------------------------------------------------------------------------516
29.15 Banker’s Discount ---------------------------------------------------------------------520
29.16 Simple Interest -------------------------------------------------------------------------520
29.17 Compound Interest --------------------------------------------------------------------520
29.18 Pipes -------------------------------------------------------------------------------------521
29.19 Stocks and Shares ---------------------------------------------------------------------521
30. Basics of Cloud Computing ------------------------------------------------------ 523
30.1 What is Cloud Computing? ------------------------------------------------------------523
30.2 Organizations are interested in Cloud Computing ---------------------------------524
30.3 Evolution of Cloud Computing --------------------------------------------------------524
30.4 Cloud Deployment Models -------------------------------------------------------------525
30.5 Types of Cloud Computing Services --------------------------------------------------526
30.6 Advantages of Cloud Computing ------------------------------------------------------526
30.7 Clustering---------------------------------------------------------------------------------528
30.8 Grid Computing--------------------------------------------------------------------------529
30.9 Virtualization -----------------------------------------------------------------------------530
30.10 Big Data ---------------------------------------------------------------------------------534
31. Miscellaneous Concepts ---------------------------------------------------------- 538
31.1 Basics of HTML and CSS ---------------------------------------------------------------538
31.2 Javascript---------------------------------------------------------------------------------545
31.3 TeX and LaTeX ---------------------------------------------------------------------------546
31.4 Ruby on Rails ----------------------------------------------------------------------------547
31.5 Google Search Tips ----------------------------------------------------------------------547
31.6 Web Crawling-----------------------------------------------------------------------------552
31.7 Google's Page Ranking Algorithm -----------------------------------------------------553
31.8 Basics of XML ----------------------------------------------------------------------------554
32. Career Options --------------------------------------------------------------------- 558
32.1 Campus Placement----------------------------------------------------------------------558
32.2 Going for M. Tech./M.S. in India------------------------------------------------------558
32.3 Going for M.S. in Foreign Countries --------------------------------------------------559
32.4 Going for MBA----------------------------------------------------------------------------559
32.5 Entrepreneurship-Start your venture ------------------------------------------------560
32.6 Trying for Government Jobs and Civil Services -------------------------------------560
32.7 Final Notes--------------------------------------------------------------------------------560
32.8 Tips to Become Successful in Your Career ------------------------------------------560
References -------------------------------------------------------------------------------563

More Related Content

PPTX
Pseudocode
PPTX
PPTX
Antigen antibody systems
PPSX
General virology
PPTX
BLOOD PLASMA
PPTX
Immunity
PPTX
AP CS PD 1.3 Week 4.pptx
PDF
MFCS PPT.pdf
Pseudocode
Antigen antibody systems
General virology
BLOOD PLASMA
Immunity
AP CS PD 1.3 Week 4.pptx
MFCS PPT.pdf

What's hot (7)

PPT
Normal flora by manoj
PPTX
Plasma proteins.pptx
PPTX
Gram negative cocci
PPT
Blood collection and its types
PPTX
Carbohydrate
PPTX
BACILLUS ANTHRACIS
PPTX
Types of flagella
Normal flora by manoj
Plasma proteins.pptx
Gram negative cocci
Blood collection and its types
Carbohydrate
BACILLUS ANTHRACIS
Types of flagella
Ad

Similar to It interview questions (20)

PDF
Datastructuresandalgorithms
PDF
Data structures and algorithms made easy
PDF
Table of contents [data structure and algorithmic thinking with python]
PDF
Sample chapters [data structure and algorithmic thinking with python]
PDF
Elements of Computer Networking: An Integrated Approach (Concepts, Problems a...
PDF
Myself Essay For Girl In English Short Essay On M
PDF
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
PDF
Entrepreneurship Reflective Learning Diary
PPTX
Cv based interview questions
PPTX
AI as a career skill.MCU AI conference slides.may 11.2024.pptx
PPTX
Ideate student
DOCX
Laptoppc use habits in academia
PDF
Peeling design patterns
PDF
Peeling Design Patterns
PDF
Graded assignment # 3
PDF
Graded assignment # 3
PPTX
Beautiful nature images it is very nice to enjoy your life
PPTX
Learning By Design - STLUX 2011
PPTX
Learning for digital natives by Lukas Ritzel, Switzerland
Datastructuresandalgorithms
Data structures and algorithms made easy
Table of contents [data structure and algorithmic thinking with python]
Sample chapters [data structure and algorithmic thinking with python]
Elements of Computer Networking: An Integrated Approach (Concepts, Problems a...
Myself Essay For Girl In English Short Essay On M
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
Entrepreneurship Reflective Learning Diary
Cv based interview questions
AI as a career skill.MCU AI conference slides.may 11.2024.pptx
Ideate student
Laptoppc use habits in academia
Peeling design patterns
Peeling Design Patterns
Graded assignment # 3
Graded assignment # 3
Beautiful nature images it is very nice to enjoy your life
Learning By Design - STLUX 2011
Learning for digital natives by Lukas Ritzel, Switzerland
Ad

More from CareerMonk Publications (6)

PPTX
Data Structures and Algorithms Made Easy
PDF
Scope, binding, papameter passing techniques
PDF
Introductionto Analysis Of Algorithms
PDF
Introductionto analysis of algorithms
PDF
Data Structures and Algorithms made Easy (Cover Page)
Data Structures and Algorithms Made Easy
Scope, binding, papameter passing techniques
Introductionto Analysis Of Algorithms
Introductionto analysis of algorithms
Data Structures and Algorithms made Easy (Cover Page)

Recently uploaded (20)

PPTX
Reinforcement Learning All Modules and Chapters
PPTX
diabetes.pptxgtgthtgtgtgthyjiulp'][pp0ppp
PDF
New Method Make Cv liek this | Get Job In 1 day|
PDF
Tn medical counselling starting from 1 to 19
PPTX
1.-NSTP-Orientation-Introductio of life a
PPTX
Role of Mi hshsjs sjskele didoels sosoen
PPTX
Intellectual Revolutionsssssssssssssssss
PDF
The Future of Careers - Bridging Education, Innovation and Global Trends
PDF
lahore 2024 august.pdf exercise for fittness
PPTX
Gender Sensitizations and females learning
PDF
Fitness_for_Futsal_Scientific_Basis_for.pdf
PPTX
AMISHA KUMARI RAWE PPT-.pptx135764766887777
PPTX
strock or cerebrovascular accident.pptx
PPTX
cctv.pptx paper presentation for school and college students
PPTX
history.pptx class deepansh 8thb today h
PPT
Basic_Fire_&_Fire_Extinguisher_Training.ppt
PDF
How To Use Aged Linkedin Accounts To Grow Your Business.pdf
PPTX
NURS1108_Lecture_7_-_Msuscular_2[1].pptx
PDF
VIT Accelerating Growth - September 2023.pdf
PPTX
Launch oxiris oxiris Toolkit for Facilities.pptx
Reinforcement Learning All Modules and Chapters
diabetes.pptxgtgthtgtgtgthyjiulp'][pp0ppp
New Method Make Cv liek this | Get Job In 1 day|
Tn medical counselling starting from 1 to 19
1.-NSTP-Orientation-Introductio of life a
Role of Mi hshsjs sjskele didoels sosoen
Intellectual Revolutionsssssssssssssssss
The Future of Careers - Bridging Education, Innovation and Global Trends
lahore 2024 august.pdf exercise for fittness
Gender Sensitizations and females learning
Fitness_for_Futsal_Scientific_Basis_for.pdf
AMISHA KUMARI RAWE PPT-.pptx135764766887777
strock or cerebrovascular accident.pptx
cctv.pptx paper presentation for school and college students
history.pptx class deepansh 8thb today h
Basic_Fire_&_Fire_Extinguisher_Training.ppt
How To Use Aged Linkedin Accounts To Grow Your Business.pdf
NURS1108_Lecture_7_-_Msuscular_2[1].pptx
VIT Accelerating Growth - September 2023.pdf
Launch oxiris oxiris Toolkit for Facilities.pptx

It interview questions

  • 1. CONCEPTS PROBLEMS INTERVIEW QUESTIONS IT Interview Questions By Narasimha Karumanchi A Primer For The IT Job Interviews
  • 2. Copyright ©2014 CareerMonk Publications. All rights reserved. All rights reserved. No part of this book may be reproduced in any form or by any electronic or mechanical means, including information storage and retrieval systems, without written permission from the publisher or author. Copyright ©2014 by 𝐶𝑎𝑟𝑒𝑒𝑟𝑀𝑜𝑛𝑘 𝑃𝑢𝑏𝑙𝑖𝑐𝑎𝑡𝑖𝑜𝑛𝑠 All rights reserved. Designed by 𝑁𝑎𝑟𝑎𝑠𝑖𝑚ℎ𝑎 𝐾𝑎𝑟𝑢𝑚𝑎𝑛𝑐ℎ𝑖
  • 3. Acknowledgements ℎ and ℎ , it is impossible to thank you adequately for everything you have done, from loving me unconditionally to raising me in a stable household, where you persistent efforts traditional values and taught your children to celebrate and embrace life. I could not have asked for better parents or role-models. You showed me that anything is possible with faith, hard work and determination. This book would not have been possible without the help of many people. I would like to thank them for their efforts in improving the end result. Before we do so, however, I should mention that I have done my best to correct the mistakes that the reviewers have pointed out and to accurately describe the protocols and mechanisms. I alone am responsible for any remaining errors. First and foremost, I would like to express my gratitude to many people who saw me through this book, to all those who provided support, talked things over, read, wrote, offered comments, allowed me to quote their remarks and assisted in the editing, proofreading and design. In particular, I would like to thank the following individuals.  ℎ , IIT Bombay, Architect, dataRPM Pvt. Ltd.  , Senior Consultant, Juniper Networks Pvt. Ltd.  ℎ ℎ , IIT Kanpur, Mentor Graphics Pvt. Ltd.  , IISc, Bangalore  ℎ , Yahoo India Pvt. Ltd.  ℎ , Development Manager, IBM Software Labs  ℎ , - ℎ., , Subjects.  ℎ B-Tech., Technical Lead, HCL  ℎ, Head Master, Obulasuni Palle, Z. P. H. School  , Teacher, Kambhampadu, Z. P. H. School  ℎ , Teacher, Durgi  ℎ ℎ , Founder, StockMonks Pvt. Ltd.  , Co-Founder, NotionPress Pvt. Ltd.  ℎ, Lecturer, Nagarjuna Institute of Technology and Sciences, MLG -𝑁𝑎𝑟𝑎𝑠𝑖𝑚ℎ𝑎 𝐾𝑎𝑟𝑢𝑚𝑎𝑛𝑐ℎ𝑖 M. Tech, 𝐼𝐼𝑇 𝐵𝑜𝑚𝑏𝑎𝑦 Founder, 𝐶𝑎𝑟𝑒𝑒𝑟𝑀𝑜𝑛𝑘 𝑐𝑜𝑚
  • 5. Preface Dear Reader, Please Hold on! I know many people do not read the preface. But I would strongly recommend that you go through the preface of this book at least. India has many of the key ingredients for making this transition. It has a critical mass of skilled, English-speaking knowledge workers, especially in the sciences. It has a well- functioning democracy. Its domestic market is one of the world’s largest. It has a large and impressive scattering, creating valuable knowledge linkages and networks. In addition, the development of the IT sector in recent years has been remarkable. India has created profitable niches in information technology (IT) and is becoming a global provider of software services. Many software companies hire graduates with different back-grounds computer science, electrical, civil, mechanical, B.E., B. Tech., MCAs, MBAs etc. The year 2013-14 characterizes a landmark year as aggregate revenue for the Indian IT-BPO sector is estimated to cross USD 120 billion. India currently produces a solid core of knowledge workers in tertiary and scientific and technical education, although the country needs to do more to create a larger cadre of educated and agile workers who can adapt and use knowledge. Efforts have been put into establishing a top-quality university system that includes many world-class institutions of higher learning that are competitive and meritocratic, such as Indian Institutes of Technology (IITs), Indian Institutes of Management, Indian Institute of Science, and the National Institute of Technology (NITs). Despite these efforts, not all publicly funded universities or other educational institutions in India have been able to maintain high-quality standards or keep pace with developments in knowledge and technology. IT Interview Questions try to facilitate pupils who arrive from colleges where they could not find proper assistance for career counselling. There are hundreds of books on IT interviews already flooding the market. You may naturally wonder what the need of writing another book on IT interviews is! This book assumes you have basic knowledge about computer science. Main objective of the book is to provide you the of and ℎ Before writing the book, I set myself the following :  The book be written in ℎ that students from non-IT branches should be able to understand it and .  The book should present the concepts in and straightforward manner with a explanation.  The book should provide enough examples so that students get better understanding of the and also useful for the / - interviews.  It should challenge you to look at the small but signifcant changes you need to make to improve your impact at interviews.  In this book you will learn all the secrets you need to know to help nail your job interview and get the job. Please remember, the books which are available in the market are lacking one or many of these goals. This book is different from other books available on the market. The main goals of this book are to provide students with a good knowledge base, and to offer a better understanding to those new to IT. Based on my experience, I thought of writing this book aiming at achieving these goals in a simple way. A 3-stage formula is used in writing this book, i.e. + +
  • 6. I used very simple language such that a school going student can also understand the concepts easily. Once the concept is discussed, it is then interlaced into problems. The solutions of each and every problem are well explained. Finally, interview questions with answers on every concept are covered. All the interview questions in this book are collected from various interviews conducted by top software development companies. Interviewing is all about research, confidence and creating a good rapport. Everyone is nervous on interviews. If you simply allow yourself to feel nervous, you'll do much better. Remember also that it's difficult for the interviewer as well. In general, be upbeat and positive. Never be negative. As a job seeker if you read complete book with good understanding, I am sure you will challenge the interviewers and that is the objective of this book. It is that, at least reading of this book is required to get full understanding of all the topics. In the readings, you can directly go to any chapter and refer. Even though, enough readings were given for correcting the errors, due to human tendency there could be some minor typos in the book. If any such typos found, they will be updated at . . I request you to constantly monitor this site for any corrections, new problems and solutions. Also, please provide your valuable suggestions at: . Wish you all the best. I are sure that you will find this book useful. -𝑁𝑎𝑟𝑎𝑠𝑖𝑚ℎ𝑎 𝐾𝑎𝑟𝑢𝑚𝑎𝑛𝑐ℎ𝑖 M. Tech, 𝐼𝐼𝑇 𝐵𝑜𝑚𝑏𝑎𝑦 Founder, 𝐶𝑎𝑟𝑒𝑒𝑟𝑀𝑜𝑛𝑘 𝑐𝑜𝑚
  • 7. Table of Contents 1. Organization of Chapters-----------------------------------------------------------17 1.1 Why Separate Book on IT Interviews? -------------------------------------------------- 17 1.2 What Is this Book About?----------------------------------------------------------------- 17 1.3 Should I Take this Book? ----------------------------------------------------------------- 18 1.4 Organization of Chapters ----------------------------------------------------------------- 18 2. Getting Ready ------------------------------------------------------------------------22 2.1 Best Ways To Get An Interview Call ----------------------------------------------------- 22 2.2 Reasons Why You Are Not Getting Interview Calls------------------------------------ 23 2.3 Does Your GPA (or Percentage) Really Matter? ---------------------------------------- 25 2.4 Hot Tips On Resume Writing ------------------------------------------------------------- 27 2.5 Designing The Resume -------------------------------------------------------------------- 32 2.6 Sample Resume ---------------------------------------------------------------------------- 34 3. Group Discussions ------------------------------------------------------------------37 3.1 What is Group Discussion?--------------------------------------------------------------- 37 3.2 Group Discussions in Interviews -------------------------------------------------------- 37 3.3 Group Discussions at Universities/Colleges------------------------------------------- 38 3.4 How to Face Group Discussion in Interviews?----------------------------------------- 38 3.5 Points to Remember ----------------------------------------------------------------------- 40 3.6 Tips for Group Discussion ---------------------------------------------------------------- 41 3.7 Do’s of a Group Discussion--------------------------------------------------------------- 43 3.8 Topics for Practicing Group DIscussions ----------------------------------------------- 44 3.9 Mock Group Discussions ----------------------------------------------------------------- 46 4. Operating System Concepts--------------------------------------------------------54 4.1 What is an Operating System? ----------------------------------------------------------- 54 4.2 Types of Operating Systems -------------------------------------------------------------- 54 4.3 Memory Management---------------------------------------------------------------------- 55 4.4 What is Job Scheduling and a Process? ------------------------------------------------ 60 4.5 Processor Scheduling Algorithms-------------------------------------------------------- 62 4.6 Process Synchronization ------------------------------------------------------------------ 63 4.7 Interprocess Communication [IPC] ------------------------------------------------------ 66 4.8 Starvation and Aging ---------------------------------------------------------------------- 70 4.9 Complier and Interpreter------------------------------------------------------------------ 71 4.10 Process Loading and Linking ----------------------------------------------------------- 71 Problems and Questions with Answers------------------------------------------------------ 74
  • 8. 5. C/C++/Java Interview Questions ------------------------------------------------ 81 5.1 Variables------------------------------------------------------------------------------------- 81 5.2 Data types ----------------------------------------------------------------------------------- 81 5.3 Data Structure------------------------------------------------------------------------------ 82 5.4 Abstract Data Types (ADTs) -------------------------------------------------------------- 82 5.5 Memory and Variables--------------------------------------------------------------------- 83 5.6 Pointers -------------------------------------------------------------------------------------- 84 5.7 Techniques of Parameter Passing-------------------------------------------------------- 87 5.8 Binding -------------------------------------------------------------------------------------- 90 5.9 Scope----------------------------------------------------------------------------------------- 91 5.10 Storage Classes --------------------------------------------------------------------------- 93 5.11 Storage Organization--------------------------------------------------------------------- 97 5.12 Programming Techniques --------------------------------------------------------------- 99 5.13 Basic Concepts of OOPS----------------------------------------------------------------101 Problems and Questions with Answers-----------------------------------------------------105 6. Scripting Languages ---------------------------------------------------------------157 6.1 Interpreter versus Compiler -------------------------------------------------------------157 6.2 What Are Scripting Languages?---------------------------------------------------------158 6.3 Shell Scripting -----------------------------------------------------------------------------158 6.4 PERL [Practical Extraction and Report Language] -----------------------------------166 6.5 Python --------------------------------------------------------------------------------------188 7. Bitwise Hacking --------------------------------------------------------------------194 7.1 Introduction--------------------------------------------------------------------------------194 7.1 Hacks on Bitwise Programming---------------------------------------------------------194 Problems and Questions with Answers-----------------------------------------------------198 8. Concepts of Computer Networking----------------------------------------------203 8.1 What is a Computer Network? ----------------------------------------------------------203 8.2 Basic Elements of Computer Networks ------------------------------------------------203 8.3 What is an Internet? ----------------------------------------------------------------------204 8.4 Fundamentals of Data and Signals-----------------------------------------------------204 8.5 Network Topologies -----------------------------------------------------------------------207 8.6 Network Operating Systems -------------------------------------------------------------211 8.7 Transmission Medium--------------------------------------------------------------------212 8.8 Types of Networks-------------------------------------------------------------------------214 8.9 Connection-oriented and Connectionless services -----------------------------------217 8.10 Segmentation and Multiplexing -------------------------------------------------------218 8.11 Network Performance -------------------------------------------------------------------218 8.12 Network Switching-----------------------------------------------------------------------222
  • 9. 8.13 Why OSI Model? -------------------------------------------------------------------------229 8.14 What is a Protocol-Stack? --------------------------------------------------------------229 8.15 OSI Model---------------------------------------------------------------------------------229 8.16 TCP/IP Model-----------------------------------------------------------------------------234 8.17 Difference between OSI and TCP/IP models-----------------------------------------236 8.18 How does TCP/IP Model (Internet) work? --------------------------------------------237 8.19 Understanding Ports --------------------------------------------------------------------239 8.20 Hypertext Transfer Protocol [HTTP] ---------------------------------------------------240 8.21 Simple Mail Transfer Protocol [SNMP]------------------------------------------------243 8.22 File Transfer Protocol [FTP] ------------------------------------------------------------244 8.23 Domain Name Server [DNS]------------------------------------------------------------245 8.24 Dynamic Host Configuration Protocol [DHCP] --------------------------------------250 8.25 How traceroute (or tracert) works?----------------------------------------------------252 8.26 How ping works?-------------------------------------------------------------------------253 8.27 What is QoS? -----------------------------------------------------------------------------253 8.28 Wireless Networking---------------------------------------------------------------------254 Problems and Questions with Answers-----------------------------------------------------255 9. Database Management Systems ------------------------------------------------ 256 9.1 What is a Database?----------------------------------------------------------------------256 9.2 Database Management System [DBMS] -----------------------------------------------256 9.3 Procedural and Non-Procedural --------------------------------------------------------257 9.4 What is SQL? ------------------------------------------------------------------------------257 9.5 Data Definition and Manipulation------------------------------------------------------257 9.6 What is RDBMS? --------------------------------------------------------------------------257 9.7 What is Table? -----------------------------------------------------------------------------257 9.8 What is Field?------------------------------------------------------------------------------257 9.9 What is Record or Row? ------------------------------------------------------------------258 9.10 What is Column? ------------------------------------------------------------------------258 9.11 What is NULL value? --------------------------------------------------------------------258 9.12 SQL Constraints -------------------------------------------------------------------------258 9.13 Data Integrity-----------------------------------------------------------------------------258 9.14 Database Keys ---------------------------------------------------------------------------259 9.15 Normalization ----------------------------------------------------------------------------259 9.16 Functional Dependencies---------------------------------------------------------------262 9.17 First Normal Form or 1NF--------------------------------------------------------------262 9.18 Second Normal Form or 2NF-----------------------------------------------------------263 9.19 Third Normal Form or 3NF-------------------------------------------------------------264 9.20 Other Normal Forms --------------------------------------------------------------------265
  • 10. Problems and Questions with Answers-----------------------------------------------------265 10. Brain Teasers -----------------------------------------------------------------------271 Problems and Questions with Answers-----------------------------------------------------271 11. Algorithms Introduction ----------------------------------------------------------274 11.1 What is an Algorithm? ------------------------------------------------------------------274 11.2 Why Analysis of Algorithms?-----------------------------------------------------------274 11.3 Goal of Analysis of Algorithms---------------------------------------------------------274 11.4 What is Running Time Analysis?------------------------------------------------------275 11.5 How to Compare Algorithms?----------------------------------------------------------275 11.6 What is Rate of Growth?----------------------------------------------------------------275 11.7 Commonly used Rate of Growths -----------------------------------------------------275 11.8 Types of Analysis ------------------------------------------------------------------------276 11.9 Asymptotic Notation and Big-O Notation --------------------------------------------276 11.10 Why is it called Asymptotic Analysis? ----------------------------------------------278 11.11 Guidelines for Asymptotic Analysis -------------------------------------------------278 11.12 Amortized Analysis---------------------------------------------------------------------279 Problems and Questions with Answers-----------------------------------------------------280 12. Recursion and Backtracking -----------------------------------------------------285 12.1 Introduction ------------------------------------------------------------------------------285 12.2 What is Recursion?----------------------------------------------------------------------285 12.3 Why Recursion?--------------------------------------------------------------------------285 12.4 Format of a Recursive Function -------------------------------------------------------285 12.5 Recursion and Memory (Visualization) -----------------------------------------------286 12.6 Recursion versus Iteration -------------------------------------------------------------287 12.7 Notes on Recursion----------------------------------------------------------------------287 12.8 Example Algorithms of Recursion-----------------------------------------------------287 Problems and Questions with Answers-----------------------------------------------------288 12.9 What is Backtracking?------------------------------------------------------------------289 12.10 Example Algorithms of Backtracking -----------------------------------------------289 Problems and Questions with Answers-----------------------------------------------------289 13. Linked Lists -------------------------------------------------------------------------290 13.1 What is a Linked List? ------------------------------------------------------------------290 13.2 Linked Lists ADT-------------------------------------------------------------------------290 13.3 Why Linked Lists? -----------------------------------------------------------------------290 13.4 Arrays Overview--------------------------------------------------------------------------291 13.5 Linked Lists Versus Arrays and Dynamic Arrays-----------------------------------292 13.6 Singly Linked Lists ----------------------------------------------------------------------292 13.7 Doubly Linked Lists ---------------------------------------------------------------------297
  • 11. 13.8 Circular Linked Lists--------------------------------------------------------------------302 13.9 A Memory-Efficient Doubly Linked List ----------------------------------------------307 Problems and Questions with Answers-----------------------------------------------------308 14. Stacks-------------------------------------------------------------------------------- 322 14.1 What is a Stack?-------------------------------------------------------------------------322 14.2 How Stacks are used? ------------------------------------------------------------------322 14.3 Stack ADT---------------------------------------------------------------------------------323 14.4 Applications ------------------------------------------------------------------------------323 14.5 Implementation --------------------------------------------------------------------------323 14.6 Comparison of Implementations ------------------------------------------------------328 Problems and Questions with Answers-----------------------------------------------------328 15. Queues ------------------------------------------------------------------------------ 336 15.1 What is a Queue?------------------------------------------------------------------------336 15.2 How are Queues Used? -----------------------------------------------------------------336 15.3 Queue ADT -------------------------------------------------------------------------------336 15.4 Exceptions --------------------------------------------------------------------------------337 15.5 Applications ------------------------------------------------------------------------------337 15.6 Implementation --------------------------------------------------------------------------337 Problems and Questions with Answers-----------------------------------------------------343 16. Trees --------------------------------------------------------------------------------- 345 16.1 What is a Tree?---------------------------------------------------------------------------345 16.2 Glossary-----------------------------------------------------------------------------------345 16.3 Binary Trees ------------------------------------------------------------------------------346 16.4 Types of Binary Trees -------------------------------------------------------------------347 16.5 Properties of Binary Trees --------------------------------------------------------------348 16.6 Binary Tree Traversals ------------------------------------------------------------------349 Problems and Questions with Answers-----------------------------------------------------353 16.7 Generic Trees (N-ary Trees) ------------------------------------------------------------366 Problems and Questions with Answers-----------------------------------------------------368 16.8 Threaded Binary Tree Traversals------------------------------------------------------368 Problems and Questions with Answers-----------------------------------------------------374 16.9 Binary Search Trees (BSTs) ------------------------------------------------------------375 Problems and Questions with Answers-----------------------------------------------------381 16.10 Balanced Binary Search Trees -------------------------------------------------------386 16.11 AVL (Adelson-Velskii and Landis) Trees --------------------------------------------387 Problems and Questions with Answers-----------------------------------------------------394 17. Priority Queues and Heaps------------------------------------------------------- 397 17.1 What is a Priority Queue? --------------------------------------------------------------397
  • 12. 17.2 Priority Queue ADT----------------------------------------------------------------------397 17.3 Priority Queue Applications------------------------------------------------------------398 17.4 Heaps and Binary Heap ----------------------------------------------------------------398 17.5 Binary Heaps -----------------------------------------------------------------------------399 17.6 Heapsort ----------------------------------------------------------------------------------404 Problems and Questions with Answers-----------------------------------------------------405 18. Graph Algorithms ------------------------------------------------------------------407 18.1 Introduction ------------------------------------------------------------------------------407 18.2 Glossary-----------------------------------------------------------------------------------407 18.3 Applications of Graphs------------------------------------------------------------------410 18.4 Graph Representation ------------------------------------------------------------------410 18.5 Graph Traversals ------------------------------------------------------------------------413 18.6 Shortest Path Algorithms---------------------------------------------------------------416 19. Sorting -------------------------------------------------------------------------------417 19.1 What is Sorting? -------------------------------------------------------------------------417 19.2 Why is Sorting necessary? -------------------------------------------------------------417 19.3 Classification of Sorting Algorithms --------------------------------------------------417 19.4 Other Classifications --------------------------------------------------------------------418 19.5 Bubble sort -------------------------------------------------------------------------------418 19.6 Selection Sort-----------------------------------------------------------------------------419 19.7 Insertion sort -----------------------------------------------------------------------------420 19.8 Shell sort----------------------------------------------------------------------------------422 19.9 Merge sort---------------------------------------------------------------------------------423 19.10 Heapsort---------------------------------------------------------------------------------425 19.11 Quicksort--------------------------------------------------------------------------------425 19.12 Tree Sort---------------------------------------------------------------------------------428 19.13 Comparison of Sorting Algorithms --------------------------------------------------428 19.14 Linear Sorting Algorithms ------------------------------------------------------------428 19.15 Counting Sort---------------------------------------------------------------------------428 19.16 Bucket sort [or Bin Sort] --------------------------------------------------------------429 19.17 Radix sort -------------------------------------------------------------------------------430 19.18 External Sorting------------------------------------------------------------------------430 Problems and Questions with Answers-----------------------------------------------------431 20. Searching----------------------------------------------------------------------------441 20.1 What is Searching?----------------------------------------------------------------------441 20.2 Why do we need Searching? -----------------------------------------------------------441 20.3 Types of Searching ----------------------------------------------------------------------441 20.4 Unordered Linear Search---------------------------------------------------------------441
  • 13. 20.5 Sorted/Ordered Linear Search --------------------------------------------------------442 20.6 Binary Search ----------------------------------------------------------------------------442 20.7 Comparing Basic Searching Algorithms ---------------------------------------------443 Problems and Questions with Answers-----------------------------------------------------443 21. Hashing------------------------------------------------------------------------------ 466 21.1 What is Hashing?------------------------------------------------------------------------466 21.2 Why Hashing?----------------------------------------------------------------------------466 21.3 HashTable ADT --------------------------------------------------------------------------466 21.4 Understanding Hashing ----------------------------------------------------------------466 21.5 Components of Hashing ----------------------------------------------------------------468 21.6 Hash Table--------------------------------------------------------------------------------468 21.7 Hash Function ---------------------------------------------------------------------------468 21.8 Load Factor -------------------------------------------------------------------------------469 21.9 Collisions----------------------------------------------------------------------------------469 21.10 Collision Resolution Techniques-----------------------------------------------------469 21.11 Separate Chaining ---------------------------------------------------------------------469 21.12 Open Addressing -----------------------------------------------------------------------470 21.13 Comparison of Collision Resolution Techniques ----------------------------------471 21.14 How Hashing Gets O(1) Complexity?------------------------------------------------471 21.15 Hashing Techniques -------------------------------------------------------------------471 21.16 Problems for which Hash Tables are not suitable---------------------------------472 22. String Algorithms ------------------------------------------------------------------ 473 22.1 Introduction ------------------------------------------------------------------------------473 22.2 String Matching Algorithms------------------------------------------------------------473 22.3 Brute Force Method ---------------------------------------------------------------------474 22.4 Robin-Karp String Matching Algorithm ----------------------------------------------474 22.5 KMP Algorithm ---------------------------------------------------------------------------475 Problems and Questions with Answers-----------------------------------------------------478 23. Algorithms Design Techniques -------------------------------------------------- 480 23.1 Introduction ------------------------------------------------------------------------------480 23.2 Classification -----------------------------------------------------------------------------480 23.3 Classification by Implementation Method -------------------------------------------480 23.4 Classification by Design Method ------------------------------------------------------481 23.5 Other Classifications --------------------------------------------------------------------482 24. Greedy Algorithms ----------------------------------------------------------------- 483 24.1 Introduction ------------------------------------------------------------------------------483 24.2 Does Greedy Always Work? ------------------------------------------------------------483 24.3 Advantages and Disadvantages of Greedy Method ---------------------------------483
  • 14. 24.4 Greedy Applications ---------------------------------------------------------------------483 24.5 Understanding Greedy Technique ----------------------------------------------------484 25. Divide and Conquer Algorithms -------------------------------------------------487 25.1 Introduction ------------------------------------------------------------------------------487 25.2 What is Divide and Conquer Strategy?-----------------------------------------------487 25.3 Does Divide and Conquer Always Work? --------------------------------------------487 25.4 Divide and Conquer Visualization ----------------------------------------------------487 25.5 Understanding Divide and Conquer --------------------------------------------------488 25.6 Advantages of Divide and Conquer ---------------------------------------------------489 25.7 Disadvantages of Divide and Conquer------------------------------------------------489 25.8 Divide and Conquer Applications -----------------------------------------------------489 26. Dynamic Programming------------------------------------------------------------490 26.1 Introduction ------------------------------------------------------------------------------490 26.2 What is Dynamic Programming Strategy? -------------------------------------------490 26.3 Can Dynamic Programming Solve All Problems? -----------------------------------490 26.4 Examples of Dynamic Programming Algorithms------------------------------------490 26.5 Understanding Dynamic Programming ----------------------------------------------491 27. Basics of Design Patterns---------------------------------------------------------494 27.1 Brief History Of Design Patterns ------------------------------------------------------494 27.2 Why Design Patterns?-------------------------------------------------------------------494 27.3 Categories Of Design Patterns ---------------------------------------------------------494 27.4 What To Observe For A Design Pattern? ---------------------------------------------495 27.5 Using Patterns To Gain Experience---------------------------------------------------496 27.6 Can We Use Design Patterns Always? ------------------------------------------------496 27.7 Design Patterns vs. Frameworks ------------------------------------------------------497 27.8 Creational Design Patterns-------------------------------------------------------------497 27.9 Singleton Design Pattern ---------------------------------------------------------------498 27.10 Structural Design Patterns -----------------------------------------------------------501 27.11 Behavioral Design Patterns-----------------------------------------------------------502 28. Non-Technical Help----------------------------------------------------------------504 28.1 Tips ----------------------------------------------------------------------------------------504 Questions with Answers ----------------------------------------------------------------------505 29. Quantitative Aptitude Concepts -------------------------------------------------510 29.1 Formulas on Number Series -----------------------------------------------------------510 29.2 Tips on Divisibility Checks -------------------------------------------------------------510 29.3 Mathematical Formulas ----------------------------------------------------------------511 29.4 Ratios and Proportions -----------------------------------------------------------------511
  • 15. 29.5 Percentage --------------------------------------------------------------------------------511 29.6 Profit and Loss ---------------------------------------------------------------------------512 29.7 Volumes and Surface Areas------------------------------------------------------------512 29.8 Logarithms--------------------------------------------------------------------------------513 29.9 Formulae for Trains Problems ---------------------------------------------------------514 29.10 Indices -----------------------------------------------------------------------------------514 29.11 Surds-------------------------------------------------------------------------------------514 29.12 Clock -------------------------------------------------------------------------------------515 29.13 Blood Relations Tricks ----------------------------------------------------------------516 29.14 Probability-------------------------------------------------------------------------------516 29.15 Banker’s Discount ---------------------------------------------------------------------520 29.16 Simple Interest -------------------------------------------------------------------------520 29.17 Compound Interest --------------------------------------------------------------------520 29.18 Pipes -------------------------------------------------------------------------------------521 29.19 Stocks and Shares ---------------------------------------------------------------------521 30. Basics of Cloud Computing ------------------------------------------------------ 523 30.1 What is Cloud Computing? ------------------------------------------------------------523 30.2 Organizations are interested in Cloud Computing ---------------------------------524 30.3 Evolution of Cloud Computing --------------------------------------------------------524 30.4 Cloud Deployment Models -------------------------------------------------------------525 30.5 Types of Cloud Computing Services --------------------------------------------------526 30.6 Advantages of Cloud Computing ------------------------------------------------------526 30.7 Clustering---------------------------------------------------------------------------------528 30.8 Grid Computing--------------------------------------------------------------------------529 30.9 Virtualization -----------------------------------------------------------------------------530 30.10 Big Data ---------------------------------------------------------------------------------534 31. Miscellaneous Concepts ---------------------------------------------------------- 538 31.1 Basics of HTML and CSS ---------------------------------------------------------------538 31.2 Javascript---------------------------------------------------------------------------------545 31.3 TeX and LaTeX ---------------------------------------------------------------------------546 31.4 Ruby on Rails ----------------------------------------------------------------------------547 31.5 Google Search Tips ----------------------------------------------------------------------547 31.6 Web Crawling-----------------------------------------------------------------------------552 31.7 Google's Page Ranking Algorithm -----------------------------------------------------553 31.8 Basics of XML ----------------------------------------------------------------------------554 32. Career Options --------------------------------------------------------------------- 558 32.1 Campus Placement----------------------------------------------------------------------558 32.2 Going for M. Tech./M.S. in India------------------------------------------------------558
  • 16. 32.3 Going for M.S. in Foreign Countries --------------------------------------------------559 32.4 Going for MBA----------------------------------------------------------------------------559 32.5 Entrepreneurship-Start your venture ------------------------------------------------560 32.6 Trying for Government Jobs and Civil Services -------------------------------------560 32.7 Final Notes--------------------------------------------------------------------------------560 32.8 Tips to Become Successful in Your Career ------------------------------------------560 References -------------------------------------------------------------------------------563