Computer Science Questions and Answers Unit-A Chapter - 1 Configuring A Computer I One Mark Question and Answer
Computer Science Questions and Answers Unit-A Chapter - 1 Configuring A Computer I One Mark Question and Answer
Computer Science Questions and Answers Unit-A Chapter - 1 Configuring A Computer I One Mark Question and Answer
UNIT-A
Chapter - 1 Configuring a Computer
CPU L2 RAM
cache
i/o units
Bridge drivers
keyboard
t
.
6. Write a note on components of motherboard.
Ans: 1) Bus : -
a. Address Bus
b. Data Bus
c. Control Bus
2) Expansion slots: They serve the purpose of adding functionality to the computer.
a. ISA : Industrial standard architecture.
b. PCI : Peripheral component interface
c. AGP : Accelerated Graphic port.
3) CACHE Memory: It is a small fast memory that resides between CPU and main
memory.
4) CMOS (Complementary Metal Oxide Semiconductor Battery )
5) I-O Ports ( Input –Output Ports ): Serial , Parallel , USB etc.,
7. Explain the different factors affecting the processing speed of CPU.
3
• Ans: CPU Speed/Clock speed: Speed of CPU also known as clock speed. The clock speed is the
number of instructions executed by the CPU in one second It is measured in megahertz(million
instructions per second). The average speed of a new CPU is about 1000MHz to 4000 MHz.(1 to 4 giga
hertz).
• Instruction set: The number of instructions decide the efficiency of a CPU. More the instructions , less
efficient is the CPU and less the instructions, More efficient is the CPU.
• Word size/Register size: The size of registers determines the amount of data the computer can work
with at a time. Normally it is 32 bits. Smaller the size of register, slower will be the computer. . It is also
known as Word size. It varies from 16 bits to 128 bits.
• Data bus capacity: Width of a data bus determines the largest number of bits that can be transported at
one time.
• Cache Memory size: Cache memory is a high speed memory. Greater the cache, faster a processor
runs. Most modern processors can execute multiple instructions per clock cycle which speeds up a
program. Some CPU’s have storage for instructions and data built inside the processor chip . This is
called internal cache or L1 cache memory.
• Memory Size: The amount of PRIMARY STORAGE (RAM) determines the size of program that can
be kept in primary storage, which is faster than secondary storage. There by the speed of computer
increases. The size of RAM varies from 64 MB to 4 GB.
Memory buffer register: This register acts as an interface between CPU and memory. When CPU
issues a Read Memory command, instruction is fetched and placed in MB register.
Instruction decoder (ID): ID is an electronic hardware, which decodes instructions. The instructions are
further broken down into a set of micro operations, so that they can be executed directly.
General purpose registers: They are used to store data. There are 6 GP registers. These are used for
storage of data as needed by the program.
Arithmetic logic unit: The basic arithmetic operations such as addition,subtraction,multiplication and
division are carried out here. These operations need atleast two operands, one which is stored in
accumulator and the other in the MBR. After the manipulation of data in ALU, the result is transferred to
accumulator.
Accumulator: During processing the intermediate data needed for future processing is stored in
accumulator. The contents of ACC are used by ALU for operations and later by MBR holds the final
result for further action.
4
Chapter - 2 Problem Solving Techniques
UNIT-B
I One Mark Question and Answer
1) Define Sorting.
Ans. Sorting is a method of arranging data items in any order.
2) What is searching?
Ans: It is a process of locating an element stored in a file.
3) Mention the different structured programming constructs.
Ans: a. Sequence
b. Selection
c. Iteration
4) What is stepwise Refinement?
Ans: Is a process of breaking down the problem at each stage to obtain a solutions.
5) Name the different searching methods.
Ans: a. Linear Search
b. Binary Search
6) Define module.
Ans: It is an independent set of statements, which can be called in another program.
7) What is the main advantage of linear search method?
Ans. It is simple and useful when the elements to be searched are not in any definite order.
8) What is the other name of bubble sort?
Ans: The bubble sort method is also called as sorting by exchange.
9) What is structured programming?
Ans: It is a method of using the concept of sequence , selection , iteration and modularity.
10) Name the searching technique which requires sorted elements.
Ans: Binary Search.
11) What is top-down analysis?
Ans: Solving a problem by breaking it up into smaller parts is called as top-down analysis.
12) What is top-down approach called as?
Ans: Top-down analysis is also called as stepwise refinement
13) What is a module?
Ans: Each program segment is called a module.
5
II Two Marks Questions:
1) Give an example for top-down analysis.
AREA OF A CIRCLE
P T R SI ← ( P * T * R ) SI P T R
100
7
Pass 1:
A[1],A[0]>16,20,4,3
Pass 2:
A[2],A[1]> 16,4,20,3
A[1],A[0]>4,16,20,3
Pass 3:
A[3],A[2]> 4,16,3,20
A[2],A[1]>4,3,16,20
A[1],A[0]> 3,4 16,20
8
Pass 2 : 3 3
16 4
4 16
20 20
Pass 3 : 3 3
4 4
16 16
20 20
Sorted order is 3 , 4 , 16 , 20
Ans: This algorithm is used to search for an element in a sorted list. The value of the element in the
middle of the list is compared with the value of the element to be searched for . If the middle
element is larger, the desired element has to be in the upper of the list. If the middle element is
smaller, the desired element has to be lower half of the list. The number of elements to be
searched is reduced by half in every iteration.
7) Write the steps involved in performing binary search operation to search an element 56
in the following numbers.
32 48 56 79 82 99
Ans: a. 32 48 56 67 79 82 99
0 1 2 3 4 5 6
Assuming ‘ a’ is the name of the array
initial values:
n=7
low = 0
high = n – 1 = 6
mid = [ low + high ] / 2 = ( 0 + 6 ) / 2 = 3
S = 56 [ search element ]
a [ mid ] = 67
Step 1 : Compare the element in a [ mid ] and search element 56
67 is not equal to 56
Step 2 : Check whether search element comes after or before the mid index element
Since 56 < 67 [ The search element is lesser than 67 , then the search element lies to the left
of mid point ]
Step 3 : Change high = mid – 1 = 3 – 1 = 2
mid = ( low + high ) / 2 = ( 0 + 2 ) / 2 = 1
Step 4 : Compare a [ mid ] and S for equality
Step 5 : Since 56 is greater than 48 [ If ( S > a [ mid ] ) i.e. 56 > 48 ]
Step 6: Change low = mid + 1 = 1 + 1 = 2
mid = ( low + high ) / 2 = ( 2 + 2 ) / 2 = 2
Step 7: Compare a [ mid ] and S for equality. Since S and a [ mid ] are equal search is successful
and the element is found at the location mid i.e. 2
10
8) Write an algorithm to find the maximum in an array
Ans: Step 1 : [Assume 1st element is the largest ]
large = A [ 0 ]
Step 2 : POS = 0
Step 3 : [ Find the largest element in the array and its position]
For I = 1 to N – 1 Do
Step 4 : If ( A [ I ] > large ) Then
Step 5 : large = A [ I ]
Step 6 : POS = 1
[ End if ]
[ End of step 3 for loop ]
Step 7: [ Print the largest and its position]
Print “ Largest = “ , large , “ position = “ , pos
Step 8: Exit
9) Write an algorithm to find the minimum in an array
11
UNIT C-CHAPTER 3
C PROGRAMMING
ARRAYS
Questions carrying one mark:-
1) What is an array?
An array is a group of data of the same data type stored in successive storage
locations.
3)What is a subscript?
A subscript or an index is a positive integer value that identifies the storage position of
an element in the array.
5)How many subscripts does a one and two dimensional array have?
one dimensional array has one subscript and a two dimensional array has two
subscripts( row and a column subscript).
12
To print elements of an array a for loop is used.
Ex: int a[10];
For(i=0;i<10;i++)
Printf(“%d\n”,a[i]);
STRINGS
Question carrying one mark:-
1) What is a string?
A string is a sequence of one or more characters.
• strcmp()- this function compares the two syrings and returns the ascii difference
between the two strings. This is case sensitive.
Syntax:Strcmp(str1,str2)
Ex: strcmp(“their”,”there”)=-9
14
• strcmpi()- this function compares specified number of characters from both the
strings and returns a value. This function is case insensitive.
Ex: strcmpi(“There”,”there”)=0
FUNCTIONS
Questions carrying one mark:-
1. What is a function?
A function is a small segment of the program(sub program) designed to perform a
specific task and return a result to the main or calling program.
16
14. How is a function invoked?
A function is invoked(or called) through an output statement or through an assigement
statement by using the function name followed by the list of arguments.
Ex: p = prod(x, y);
17
sort(a, n); (where sort is the function name)
}
18
3. Why is the return statement is required in a function body?
When a function is called control is transferred from the calling function (main
program) to the called function (sub-program). The statements of the called function are
executed and finally the called function is terminated and sends the required result back to
the calling function. The return statement is used to send the result from the function to the
main program, thus terminating the called function.
The syntax is: return;
Or
return(expression);
The first form does not return any value, where the second function returns the
value of the expression.
Return data type- indicates the data type of variable sent back from called
function to calling function
Function name- indicates the name of the function .It is an identifier
Argument list- list of input variables and their datatypes received from calling
function
19
Local variable declaration-list of data that required only for the function block in
which they are declared.
Body of the function-It includes declaration part (local variables) and a set
of executable statements which will perform the required task.
Return statement- indicates termination of function and transfer of control from called
function to calling function
Ex:
int sum(int a,int b)
{
int c;
c=a+b;
return(c);
}
2. Mention different types of functions. Explain any one(or any specific type may
be asked)
Note: The explanation should include syntax and example
The different types of functions are
1. functions with no input and no return value
2. functions with input and no return value
3. Functions with input and return value
4. Recursive functions
1. functions with no input and no return value- In this type of functions ,the user
defined function does not receive any input and does not send back any result to the
calling function.
Syntax:
20
Calling function ACTION Called function
{ {
..……..; ……………;
F1(); ………………;
……….; return;
Ex:
void main()
{
void msg();
msg();
}
msg()
{
printf(“hello world\n”);
}
2. functions with input and no return value- In this category of functions, the called
function receives one or more input values, but does not send any output(return
value) to the calling function
Syntax:
21
Callin function ACTION Called function
{ {
..……..; ……………;
F1(a,b); ………………;
……….; Return;
Ex:
void main()
{
void sum(int,int);
int a,b;
scanf((“%d%d”,&a,&b);
sum(a,b);
}
Void sum(int p, int q)
{
int r;
r=a+b;
printf(“sum of two numbers=%d\n”,r);
return;
}
3. functions with input and return value- In this category of functions ,the called
function receives one or more inputs and sends a return value to the calling function
Syntax:
22
Callin function ACTION Called function
{ {
..……..; ……………;
X=F1(a,b); ………………;
……….; Return(v1);
Ex:
void main()
{
int sum(int,int);
int a,b,X;
scanf((“%d%d”,&a,&b);
X=Sum(a,b);
printf(“sum of two numbers=%d\n”,X);
}
int sum(int p, int q)
{
r=a+b;
return(r);
}
Example:
void main()
{
int fact(int);
int n;
scanf(“%d”,&n);
printf(“factorial=%d\n”,fact(n));
getch();
}
int fact(int m)
{
if(m==0)
return(1);
else
return(m*fact(m-1));
}
24
types. This list of data are known as formal parameters. The formal parameters
receive their value from actual parameters.
o The formal parameter values are available only as long as the function is
being executed.
o For every actual argument there must be a formal argument of the same data
type.
o Any changes made to the formal parameters in the called function do not
change the actual parametersOnce the function is terminated the formal
parameters are not available any more.
Ex: Int prod(int m, int n) function header
Local variables
Local variables are the data declared within a user defined function and available only
within that function.
Ex:
int sum(int a, int b)
{
int r;
…………
………..
Global variables
Global variables are the data that are declared before the main program and that are
available to the main program as well as the functions that are called from the
main program.
int p,r;
void main()
{
4. What are storage classes? Mention different types of storage classes. Explain
A storage class refers to the scope of data in a program. Scope of data means the
25
portion of the program in which the variable is valid(mian() as well as sub
programs) and lifetime of the variable.i.e., the length of time to which the variable
retains its value.
Ex:
register int x,y;
• Scope of the variable is local
• The variables are stored in registers
• Needs explicit declaration
• Initial value is not known
26
Static storage class
Static storage class is used in function blocks. The static variable can be initialized exactly
once when the function is called for the first time. For subsequent calls to the same
function, the static variable stores the most recent value.
Key word static precedes the variable declaration
Ex: static int x,y,z;
POINTERS
Questions carrying one mark:-
1) What is a pointer?
A pointer is a dynamic variable that stores address of a data value in a program.
2) How is a pointer declared in a c program?
syntax: datatype * pointer name;
Ex: int *p1,x=230;
3) Name the operators used in pointers?
* and & operators
4) How is a pointer initialized . give an ex.
Initializing a pointer means storing the address of the data variable in to a pointer.
Ex: p1=&x;
5) What is meant by a pointer to an array?
A pointer to an array stores address of the 1st data element of the array.
Ex: int *p1,a[4];
P1=a; or p1=&a[0];
6) If ptr is a pointer to an integer what is the meaning of an expression ptr++; ?
ptr++; will increment the pointer and will make the pointer store address of next data
element in the array.
7) What is meant by an array of pointers?
An array of pointer means a pointer array where every individual data is a pointer
variable that holds an address.
Ex: int*p1[10],a[10],b[10],c[10];
P1[0]=&a[0];
P1[1]=&b[0];
P1[2]=&c[0];
8) Is it possible to add two pointers?
no.
27
Question carrying two marks:-
1) With an example discuss the operators used with pointers.
• * indirection operator. This operator is used to declare a pointer.
• &- address operator. This operator is used to locate the address of a pointer.
EX: int x=245,*ptr;
Ptr=&X;
¾ Ptr- stores address of X
¾ X-value stored=245
¾ &X-address of X
¾ *ptr- contents of location whose address is stored in ptr(245)
¾
30
3) What is meant by an array of structures?
An array of structures contains data elements of every structure variable stored in to an
array.
Ex: struct student
{
Int reg no;
Int age;
Char name[20];
}s[15];
Structures Arrays
1) Definition and declaration of program 1) Definition and declaration of
in structures are different. program in arrays are the same.
2) a structures is a group of data of 2) An array is a group of data of
different data types. same data types.
3) Nested structures are also accessed in 3) No nested arrays are used in
structures. arrays.
4) Structure members are accessed by 4) Index is used to access data in
using dot (.) operator. arrays.
5) In structures, we use a reserved word 5) In arrays, we do not use any
like struct. reserved word.
FILES
Questions carrying one mark:-
1) What is a file?
A file is a collection of data that is available in permanent storage.
32
Mode Action
1)r 1)opens a file for reading
2)w 2) opens/creates a new file for writing
3) opens a file for appending data or
3)a creates a new file
33
fread()- this function is used to read data into a structure from a file.
Syntax:
fread(&structure varable,size of(struct structurevariable),1,filepointer);
Ex: fread(&s,size of(struct s),1,fp);
feof()- this function returns a value true or false. When a file is being read, if there is no
more data in the file, then feof() function returns a value true. When a file is being read, if
there is more data in the file then the function returns a value false.
*********************************************************
What is Data?
Data is the basic element in any computer processing. Data is a raw (unprocessed) fact or collection of
facts and figures or an observation. It may be number, an alphabet, or a sequence of characters.
For example 25, A, Sanjana etc.
What is Information?
Information is a processed data and has an implicit meaning. Information is a structured data. It is useful
for decision making.
1. Strategic information
2. Tactical information
3. Operational information
4. Statutory information
1. Strategic Information:
• It is needed for long-term business goals and objectives.
• This directs the prospects of the business.
• Organizations aim for expanding their business, increasing the sales and profits, enhancing their
customer base, building their band, and grabbing the market capital.
• The marketing team observes the trends of the business and collects the sampling data and arrives
at strategic information.
2. Tactical Information:
• This type of information is needed for short term business goals and objectives.
• This information helps managers to make valid decisions to run the business efficiently and
effectively.
• In a small business organization, information on fast moving goods may be used to make tactical
decisions. Tactical information is obtained from the day-to-day transactions.
34
3. Operational information:
• It is required for daily business operations. Such as list of items which is out of stock. This
information can be used to trigger the purchase department to purchase those items and fill in the
inventory.
Eg : The information like list of customers who have not paid even after the
due date would be used to send the remainders.
• Operational information is obtained from the data processing group in the organization.
4. Statutory information:
• This information is provided by the Government as the regulation to be followed by the
organizations.
• Organizations must communicate to the government authorities about the results of their revenue,
profit and stock holder benefits such as dividend and bonus.
• The data processing system would provide the required information.
Input Storage
Output
Report
1. Data collection
2. Data preparation
3. Data entry
Data Collection:
Data Preparation:
• Is a process of creating the documents for further processing. In this step, the data collected is
put into a data sheet.
Data entry:
• Is a process of entering data into the computer for data processing. The data may be entered into
the computer through various input devices such as keyboard, optical scanners or magnetic
character recognizers.
• Eg: To generate marks report of the student, collect roll-no, name, each subject marks
Processing:
The data entered has to be processed. This process involves the following five steps.
1. Storage
2. Retrieval
3. Categorization
4. Organization
5. Updation
1. Storage: is a computer memory where data is stored permanently for future processing. The
data may be stored on a magnetic tape, hard disk or optical disks.
2. Retrieval: is a process of getting the desired data from storage. There are a set of commands
which will help accessing memory and fetching data for processing.
3. Categorization: is a method, which classifies data into most recent and least recent data. The
data can be old or new.
36
i) When a new batch of students get admitted to the course, data pertaining to this batch is added
to the student information system and when someone discontinues the course, his/her records are
deleted from the system.
ii) To generate marks report, to calculate total, average, grade etc.
Output:
This is the process of getting the results printed on paper. (Printout)
The printout can be obtained in the following 2 steps.
1. Report generation
2. Inquiry generation
Report generation:
Is a process of providing the hard copy output.
For eg: after the examination, the results can be printed on paper.
Inquiry response:
is a process of providing an individual report on inquiry.
For eg: Inquiry about those students who have got distinction, first class, second class and so on.
Files are the backbone of any data processing and database management system. They are used to store
business data and records.
What is database?
A database is a collection of logically related data
1. File creation
2. Location a record
3. Adding a record
4. Deleting a record
5. Modifying a record
Types of Files:
• Master file
• Transaction file
Write the difference between Master file and Transaction File
37
Master File Transaction File
1) The data stored in these files are 1) The data stored in these files are
permanent by nature temporary by nature
2) This file is empty while nature 2) This file contains data only for period of
time and send to the master file
3)This files are updated only through recent 3) Any data to be modified is done in this
transactions file
4) This file stores large amount of data 4) In this file the data to be modified is
Eg: customer ledgers, student database stored . Eg: price of the products,
customers order for the products, inserting
new data to the database etc.
FILE ORGANIZATION:
It refers to the way of arranging the records in a file which can be accessed in a faster way.
. The criteria considered in choosing a file organization are:
1) Fast access to single record or collection of related records.
2) Easy record adding/ update/ removal without disrupting.
3) Storage efficiency
4) Redundancy as a warranty against data corruption.
• Physical file organization: The data which is stored in the form of records can be
placed in any storage devices, main memory, secondary memory etc.
Advantages:
1) Simple to understand
2) Easier to organize, maintain
38
3) Economical
4) Error in files remain localized
Disadvantages:
1) Entire file has to be processed
2) Transactions must be sorted in a particular sequence before processing
3) Time consuming searching
4) High data redundancy
5) Random enquiries are not possible to handle
Advantages:
1) Immediate Access of the desired records.
2) No sorting of the records is required.
3) Faster updating of several files.
4) Helps in online transaction processing system like online reservation systems.
Disadvantages:
1) Data may be accidentally erased or over-written unless special precautions are taken
2) Backup facility is needed
3) Expensive- hard disks are needed to store the records, it is expensive
4) Less efficient as compared to sequential file organization in the use of storage space
5) Only one key is used
6) Cannot be accessed sequentially
Advantages:
1) Multilpe keys – are also alphanumeric in nature
2) Both sequential and random access is possible
3) Accessing of records is fast, if the index table is properly organized
Disadvantages:
1) More storage space is needed because of the presence of Index
2) Less efficient in the use of storage space as compared to other file organizations
3) It requires special software, i.e expensive.
39
DBMS
What is DBMS?
DATABASE MANAGEMENT SYSTEM is a software used for management, maintenance
and retrieval of data stored in a database.
Eg : Oracle, MS-Access, Sql server etc.
Write the difference between Manual Data and Electronic Data Processing.
40
MS-Excel
42
SQL (Structured Query Language)
Expand SQL.
Ans: SQL stands for Structured Query Language.
Expand DDL.
Ans: DDL stands for Data Definition Language.
Expand DML.
Ans: DML stands for Data Manipulation Language.
Name the SQL command for deleting tuple from the database.
Ans: Delete from tablename where condition;
This command is used to erase certain unwanted rows from the table.
Name the SQL command for inserting tuple from the database.
Ans: The insert command is used to insert one or more rows (new records) to an existing
table.
What is structured Query Language? Write the SQL command for deleting
tuple(row) from the database.
Ans: SQL is a relational database language designed and developed
43
to create a database, delete, update or retrieve data from a
database.
The delete command is used to erase certain unwanted rows from the table.
Example:
Insert into student values(145, ‘Kumar’, ‘I PUC’, ‘PCMC’, 4500.00)
Write the syntax and example for deleting a table using DROP.
Ans: Drop command is used to remove unwanted tables from the database.
Syntax: Drop table tablename;
44
UNIT E
Fundamentals of Network operating system
Question carrying 1 marks :-
1) What is a computer network?
It can be defined as interconnection of autonomous computers and terminals
together using communication systems to facilitate exchange of information.
2) Mention the advantage of networking.
speed, cost, etc
3) Mention the different types of network.
Local area network(LAN),
Wide area network(WAN),
Metropolitan area network(MAN)
4) What is a file server?
It is the main component of the network. It is a very fast computer with a large
amount of RAM and storage space. File server stores all the files and
application software and operating system.
5) What is a work station?
It is also referred to as nodes, clients are the computers connected to the file
server.
6) Mention the most widely used interface card.
Ethernet cards
7) What are routers?
a router translates information from one network to another. Routers select the
best path to route a message based on the destination address and origin.
8) What are switches?
it is a device that provides a central connection point to cables from server’s
workstations and peripherals.
9) What are the functions of the bridges in the network?
It provides link between the older network and the new network.
• Security: The information on the computer can bemade available only through
password.Further some information can be made available only for reading and
not copying.
• Easy access: Users can access information from any computer that is available on
the network. They need go to a specific Computer which may be located in a
different building or different location to retrieve information from their account.
• Print Services- When Printers available on the Network , multiple users can print to
the same printer. The network printers are usually faster and more capable. They
may have accessories such as envelope readers or multiple paper trays
• Database Services-Multiple users can have access to the database at the same time.
The Database software ensures integrity of data and provides multiple access.
47
STAR- in star network, each node is connected directly to the central computer. All
communications between the nodes have to pass through the central computer. Star
networks allow the administrator to give selected nodes higher priority and also allow
centralized running of diagnostic programs.
RING- in a ring network, all nodes are connected to a common cable, and the cable
starts and ends at the network server. In this type of network, communications are
always in one direction, and the data being transmitted is passed through each node in
the ring. A major disadvantage of this network is that when a node fails, it can
completely halt all communications on the network.
TREE- a tree topology combines characteristics of linear bus and star topologies. It
consists of groups of star configured workstations connected to a linear bus backbone
cable. Tree topologies allow for the expansion of an existing network, and enable
schools to configure a network to meet their needs.
MESH- a pure mesh network has point- to- point connections between every node in
the network. Pure mesh architectures are not usually considered practical. One problem
is that each device requires an interface for every other device on the network.
48
Limitations(Disadvantages)
• Initial investment may be expensive
• Maintenance will require staff who must ensure efficient operations
• If the server breaks down , the operations of client processes may stop.
Advantages
• There is no need for dedicated server. Therefore less expensive.
• A single user operating system such as windows-XP is sufficient
Disadvantages(Limitations)
• There can be no security as all computers can be accessed by all users
• A failure of a node in peer-peer network means the network can no longer access
data or applications on that node.
• The number of Computers connected are limited to 10 or 12
Note : to write the features of windows NT(Network operating system) same features can be high
lighted. In addition to this the following points may be added.
• Supports client-server applications
• Management of networks
49
• Wide range of support tools are available such as debugging tools,compilers and
other software.
• Hierarchial directory structure for maintenance of directories and files
****************
50