Chapter 5384
Chapter 5384
CRACK JECA
ENTRANCE EXAM BOOK FOR MCA ASPIRANTS
(As per the New Syllabus)
Published by : Mrs. Meena Pandey for Himalaya Publishing House Pvt. Ltd.,
“Ramdoot”, Dr. Bhalerao Marg, Girgaon, Mumbai - 400 004.
Phone: 022-23860170, 23863863; Fax: 022-23877178
E-mail: [email protected]; Website: www.himpub.com
Branch Offices :
New Delhi : “Pooja Apartments”, 4-B, Murari Lal Street, Ansari Road, Darya Ganj,
New Delhi - 110 002. Phone: 011-23270392, 23278631; Fax: 011-23256286
Nagpur : Kundanlal Chandak Industrial Estate, Ghat Road, Nagpur - 440 018.
Phone: 0712-2721215, 2721216
Bengaluru : Plot No. 91-33, 2nd Main Road, Seshadripuram, Behind Nataraja Theatre,
Bengaluru - 560 020. Phone: 080-41138821; Mobile: 09379847017, 09379847005
Hyderabad : No. 3-4-184, Lingampally, Besides Raghavendra Swamy Matham, Kachiguda,
Hyderabad - 500 027. Phone: 040-27560041, 27550139
Chennai : No. 34/44, Motilal Street, T. Nagar, Chennai - 600 017. Mobile: 09380460419
Pune : “Laksha” Apartment, First Floor, No. 527, Mehunpura,
Shaniwarpeth (Near Prabhat Theatre), Pune - 411 030.
Phone: 020-24496323, 24496333; Mobile: 09370579333
Cuttack : Plot No. 5F-755/4, Sector-9, CDA Market Nagar, Cuttack - 753 014,
Odisha. Mobile: 09338746007
Kolkata : 3, S.M. Bose Road, Near Gate No. 5, Agarpara Railway Station,
North 24 Parganas, West Bengal - 700109. Mobile: 9674536325
DTP by : Sudhakar Shetty (On behalf of HPH)
Printed at : Geetanjali Press Pvt. Ltd., Nagpur (On behalf of HPH)
(iii)
PREFACE
The field of Computer Science is very vast and so are the syllabi of the MCA entrance
examination. The main aim of this book is to spread the knowledge attained by the authors to the
target aspirants. It caters to the needs of the candidate aspiring for competitive examinations,
especially JECA examination and for the beginners to understand the subject’s intricacies. An
effort has been made to combine all mentioned examination topics under a book. The entire
syllabus is divided into chapters, sections and subsections. A clear and lucid explanation of all the
topics helps understand the subject nicely.
Almost all the competitive examinations are hereby conducted through multiple choice
questions (MCQs). The options provided within the question appear confusing even to the best if
not practiced well. It is intended to enable the students to prioritize and plan their learning
through regular practice. Each chapter is provided with 25 solved questions and 50 unsolved
questions. The questions are formulated in a way that will grow the confidence of the subject
among the aspirants. It will help the students face the competition at any time and any place.
We believe that students seeking compact, significant self-study and up-to-date contents will
find this book to be a valuable resource. Some errors may inevitably appear; we shall be grateful
to the reader for pointing them out and for any recommendations for improving the text.
Authors
(vi)
(vii)
ACKNOWLEDGEMENTS
Writing a book is like a major project and is rarely the work of a single individual. We thank
our teachers and seniors for providing a wealth of knowledge, sharing the depth and breadth of
their experience, and answering a barrage of our questions. Our numerous students, whose
valuable discussions are a key constituent of this book.
During the compilation and writing of this work, we have been fortunate enough to receive
valuable suggestions, timely assistance and humble support from our colleagues and friends.
Special thanks to our mentors Dr. Biswapati Jana, Dr. Jaydeb Bhaumik, Dr. Debasis Giri,
Dr. Kakali Datta, Prof. Jyotsna Kumar Mandal and Dr. Dhiman Saha for extending their support
in our academic growth. They were extremely generous to clear our doubts whenever we required.
We also convey our heartfelt thanks to the faculty members of the Department of Computer
Science, Vidyasagar University for their encouragement and help. We want to thank all the
technical and non-teaching staff of the Department as well for supporting us.
We want to bow down to our first Guru, our parents, who led the foundation by generating a
quest for knowledge in our minds and for making us competent enough to write this book. We
would not be able to get our work done without the continual support, love and blessings of our
beloved family members.
We are grateful to the Himalaya Publishing House Pvt. Ltd., Publishing Editor, for initiating
all of us into this venture and Lalita Ji, Publication Response Division, for the continuous
cooperation, assistance and timely feedback. Without their conscientious effort and personal
involvement, this work would not have been possible.
We would also like to thank the production team for their efforts.
We wish to acknowledge the efforts of our reviewer(s) for providing countless suggestions
for improving the content and presentation.
Thank you!
Pabitra Pal
([email protected])
Partha Chowdhuri
([email protected])
Prabhash Kumar Singh
([email protected])
(viii)
(ix)
CONTENTS
1. C PROGRAMMING 1 – 28
1.1 Introduction
1.2 Keyword and Identifier
1.3 Data Types and Variables
1.4 Input Output
1.4.1 Format Specifier
1.5 Operators and Expressions
1.6 Storage Classes
1.7 Function
1.7.1 Recursive Function
1.8 Loops
1.8.1 For loop
1.8.2 While Loop
1.8.3 Do-while Loop
1.8.4 Break Statement
1.8.5 Continue Statement
1.9 Array
1.9.1 What is an Array?
1.9.2 Declare and Initialize an One-dimensional Array
1.9.3 Access the Elements of One-dimensional Array .
1.9.4 Important Properties of Array
1.9.5 Declare and Initialize a Two-dimensional Array
1.10 String
1.10.1 Declaring a String
1.10.2 Initialize a String
1.10.3 Commonly used String Handling Functions
1.11 Pointer
1.11.1 Define a Pointer Variable
1.11.2 Using Pointers in Function
1.12 Structure and Union
1.12.1 Syntax to Define a Structure and Union
1.12.2 Declaring Structure and Union Variable
1.12.3 Initializing and Using Structure Variables
1.12.4 Size of Structure and Union
(x)
5.5.3 Disadvantages
5.6 RAM and ROM
5.7 Pipeline
5.7.1 Types of Pipeline
5.7.2 Advantages
5.7.3 Disadvantages
5.8 System Calls
5.8.1 How it Works?
5.8.2 Need for System Calls
5.8.3 Types of System Calls
5.8.4 Some Examples of System Calls
5.9 Solved Questions
5.10 Practice Question Sets
6. OPERATING SYSTEM 137 – 174
6.1 Introduction
6.1.1 Goal of an Operating System
6.1.2 Functions of an Operating System
6.2 Important Terminologies
6.2.1 Kernel
6.2.2 System Call
6.2.3 Batch System
6.2.4 Spooling
6.2.5 Multi-programming
6.2.6 Multi-processing
6.2.7 Multi-tasking
6.2.8 Time-sharing System .
6.3 Process
6.3.1 Process State
6.4 Process Scheduling
6.4.1 Process Scheduler
6.4.2 Types of Scheduler
6.4.3 Context Switching
6.4.4 Scheduling Performance Criteria
6.4.5 Scheduling Algorithms
6.5 Process Synchronization
(xvi)
8.3.5.1 Entity
8.3.5.2 Attributes
8.3.5.3 Relationships
8.4 Database Design
8.4.1 Integrity Constraints
8.4.2 Normal Forms
8.4.3 Attribute Closure
8.4.4 Key
8.4.4.1 Super Key
8.4.4.2 Candidate Key
8.4.4.3 Primary Key
8.4.5 Decomposition
8.4.5.1 Relation between Two Functional Dependency (FD) Sets
8.5 Transactions and Concurrency Control
8.5.1 Transactions
8.5.2 Schedule
8.5.2.1 Serial schedule
8.5.2.2 Concurrent Schedule
8.6. File Structures
8.6.1 Sequential Files
8.6.2 Indexing
8.6.3 B-tree
8.7 Structured Query Language (SQL)
8.7.1 SQL Commands
8.8 Query Optimization
8.8.1 Purpose of Query Optimization
8.8.2 Various Query Optimization Strategies
8.8.3 Important Points on Optimization
8.9 Solved Questions
8.10 Practice Question Sets
9. SOFTWARE ENGINEERING 237 – 270
9.1 Introduction
9.2 Software
9.2.1 Characteristics of Software
9.2.2 Software Engineering
(xx)
9.2.2.1 Support
9.2.2.2 Software Process .
9.3 Process Models
9.3.1 Conventional Process Model
9.3.1.1 Waterfall Model
9.3.1.2 Prototype Model
9.3.1.3 Rapid Application Development
9.3.2 Evolutionary Process Model
9.3.2.1 Evolutionary Process Model
9.3.2.2 Spiral Model
9.3.2.3 Component-based Development Model
9.4 Measurement of Metrics
9.4.1 Size-oriented Metrics
9.4.1.1 Line of Code
9.4.1.2 Function Point Analysis
9.4.2 Effort and Schedule (Duration) Estimation
9.4.2.1 Constructive Cost Model
9.4.2.2 Defect Rate
9.4.2.3 Defect Removal Efficiency
9.4.2.4 Halstead Size-oriented Metric
9.5 Risk Analysis
9.5.1 Risk Identification
9.5.1.1 Risk Strategy
9.5.1.2 Types of Risk
9.5.1.3 Risk Components
9.5.2 Risk Projection or Risk Estimation
9.6 Software Development Life Cycle
9.6.1 Requirement
9.6.1.1 External Interfaces
9.6.1.2 Requirement Engineering
9.6.1.3 Elicitation
9.6.1.4 Analysis
9.6.2 Design
9.6.2.1 Concept of Design
9.6.2.2 Cohesion
(xxi)
9.6.2.3 Coupling
9.6.2.4 Software Architecture
9.6.2.4.1 Control Hierarchy
9.6.2.4.2 Data Structure
9.6.2.4.3 Software Procedure
9.6.3 Coding
9.6.4 Testing
9.6.4.1 Structural Testing
9.6.4.1.1 Basis Path Testing
9.6.4.1.2 Cyclomatic Complexity
9.6.4.1.3 Graph Matrices
9.6.4.1.4 Control Structure Testing
9.6.4.2 Black-box Testing
9.6.4.3 Life Cycle Testing
9.6.4.4 Validation Testing
9.6.4.5 Integration Testing
9.6.4.5.1 Top-down Integration
9.6.4.5.2 Bottom-up Integration
9.6.4.6 Regression Testing
9.6.4.7 Smoke Testing
9.6.4.8 Unit Testing
9.6.4.9 Alpha Testing
9.6.4.10 Beta Testing
9.6.4.11 System Testing
9.7 Solved Questions
9.8 Practice Question Sets
10. MACHINE LEARNING 271 – 290
10.1 Introduction
10.1.1 What is ML?
10.1.2 ML Life Cycle
10.1.3 ML in Current Scenario
10.2 Classification
10.2.1 Supervised Learning
10.2.1.1 Classification
10.2.1.2 Regression
(xxii)
SYLLABUS
Variables and Data Types, I/O Operations, Operators and Expressions,
Control Flow Statements, Functions, Array, Pointers, String Handling,
Structures and Unions, Files Handling, Pre-processor Directives,
Command Line Arguments.
1.1 INTRODUCTION
C is a general-purpose, procedural programming language. It was developed at Bell Labs by
Dennis Ritchie, between 1972 and 1973. During the 1980s, C gradually gained popularity. C has
been standardized by the American National Standards Institute (ANSI) since 1989 and
subsequently standardized by the International Organization for Standardization (ISO).
A procedural language is a type of programming language that consists of a series of well
structured steps and procedures within its programming context to write a program. It contains a
systematic order of statements, functions and commands to complete a program. That means, it
consists of a set of instructions and divides these instructions into smaller parts known as
functions for the computer to perform.
In C programming, scanf() is one of the commonly used functions to take input from the
user. The scanf() function reads formatted input from the standard input such as keyboard.
#include <stdio.h>
int main()
{
int roll;
printf(“Enter a roll number:”);
scanf(“%d”, &roll);
printf("Roll Number=%d", roll);
return 0;
}
In this program, %d is a format specifier which is used in the scanf() function to take the
input (roll) from the keyboard as an integer (int). When an integer is entered through the keyboard,
it is stored in the roll variable.
1.4.1 Format Specifier
To format different data types inside the printf or scanf function, different format specifiers
are used. For example, if we want to print the value of an integer variable using the printf
function, we have to use %d as the format specifier.
int i=10;
printf("The value of i = %d", i);
The format specifiers for other data types are given in the Table 1.2.
Note that, both %d and %i format specifiers can be used for an integer type. Here, %i
specifies integer whereas %d specifies signed decimal integer. For printf function, both these
format specifiers can be used interchangeably. But, in scanf function %d and %i behaves
differently. In scanf, the %d always takes integer value as signed decimal integer. Whereas, the
%i takes an integer value as signed decimal, hexadecimal or octal type. So, the scanf function
can take octal or hexadecimal input from the keyboard using %i only.
Table 1.2: Format Specifiers for Different Data Types
Data Type Format Specifier
int %d, %i
char %c
float %f
double %lf
short int %hd
long int %ld, %li
4 CRACK JECA
unsigned int %u
long long int %lld, %lli
unsigned long int %lu
unsigned long long %llu
int
long double %Lf
(c) Static: The static specifier gives the declared variable static storage class. Static
variables can be used within a function. Static variables are not visible outside their
function. But, static variables maintain their values between calls.
(d) External: The extern specifier gives the declared variable external storage class. No
storage is allocated to an extern variable. It is assumed that the variable has already
been defined elsewhere in the program. When we use an extern specifier the variable
cannot be initialized because an extern variable is only declared, not defined.
1.7 FUNCTION
A function is a block of statements that perform a particular task. Every C program has at
least one function which is main() function. We can divide our code into separate functions. A
function declaration tells the compiler about a function’s name, parameters, and return type. A
function definition provides the body of the function.
Every function has four parts: Function Name, Function Parameter, Function Body and
Return Type.
//int: return type
//sum: function name
//int m, int n: function parameters
int sum(int n, int m){
// function body
return m + n;
}
1.8 LOOPS
Loops are used to execute a block of code repeatedly according to a condition given in the
loop. There are 3 loops: for loop, while loop and do-while loop.
1.8.1 For loop
The syntax of for loop is:
for (initialization; condition; update){
// code block
}
The initialization statement is executed only once. The condition expression is evaluated
every time before the loop is executed. The update expression is executed at the end of each
iteration. The loop is repeatedly executed until the condition expression is false. For loop is
generally used when the number of iterations is known.
1.8.2 While Loop
The syntax of a while loop is:
while (condition){
//code block
}
The while loop evaluates the condition before each iteration. If the condition is true, i.e.,
non-zero, codes inside the body of the while loop are executed. When the condition is false or
zero, the while loop is terminated.
1.8.3 Do-while Loop
The syntax of a do-while loop is:
do{
// code block
}while(condition);
The code inside the loop is executed once. Then, the condition is evaluated. If the condition
is true or non-zero, the code inside the loop is executed again. When the condition is false or zero,
the do-while loop is terminated.
The do-while loop is similar to the while loop. But there is an important difference. The
body of the do-while loop is executed once before checking the condition. So, unlike while loop,
a do-while loop is executed at least once.
C Programming 7