chettinadtech.ac.inchettinadtech.ac.in/.../12-08-31/12-08-31-12-24-27-1697 …  · web viewanna...

18
ANNA UNIVERSITY OF TECHNOLOGY, COIMBATORE B.E/B.TECH.DEGREE EXAMINATIONS: JUNE/JULY 2010 REGULATIONS: 2008 FIRST SEMESTER 080230001-FUNDAMENTALS OF COMPUTING AND PROGRAMMING (COMMON TO ALL BRANCHES) TIME:3 HOURS MAX.MARKS:100 PART-A ANSWER ALL QUESTIONS 1. What are the different components of a computer? Components of a computer system is classified into two main groups : Hardware Software 2. What is the use of computer in medicine and health care? 3. Convert(6245.14) 8 to its decimal equivalent. 6 2 4 5 . 1 4 __________________________________________ 8 3 8 2 8 1 8 0 . 8 -1 8 -2 6*8 3 2* 8 2 4*8 1 5*8 0 . 1*8 -1 4*8 -2 ___________________________________________________________________________ 3072 + 128+ 32+ 5 + 0.8+ 0.256 = (3238.056) 10 ________________________________________________________________________________ 4. Convert (ebc) 16 in to their binary equivalents. e b c 1110 1011 1100 Thus,the binary equivalent of (ebc) 16 is(111010111100) 2 SOFTWARE SYSTEM SOFTWARE APPLICATION SOFTWARE HARDWARE CPU PERIPHERALS

Upload: vuliem

Post on 03-Aug-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

ANNA UNIVERSITY OF TECHNOLOGY, COIMBATOREB.E/B.TECH.DEGREE EXAMINATIONS: JUNE/JULY 2010

REGULATIONS: 2008FIRST SEMESTER

080230001-FUNDAMENTALS OF COMPUTING AND PROGRAMMING(COMMON TO ALL BRANCHES)

TIME:3 HOURS MAX.MARKS:100

PART-AANSWER ALL QUESTIONS

1. What are the different components of a computer?Components of a computer system is classified into two main groups :

Hardware Software

2. What is the use of computer in medicine and health care?

3. Convert(6245.14)8 to its decimal equivalent.6 2 4 5 . 1 4__________________________________________

8 3 82 81 80 . 8-1 8-2

6*8 3 2* 82 4*81 5*80 . 1*8-1 4*8-2

___________________________________________________________________________

3072 + 128+ 32+ 5 + 0.8+ 0.256 =(3238.056)10

________________________________________________________________________________

4. Convert (ebc)16 in to their binary equivalents. e b c 1110 1011 1100Thus,the binary equivalent of (ebc)16 is(111010111100)2

5. Distinguish between application software and system software.Application software:

It is the set of programs necessary to carry out operations for a specified application.

System software:

PERIPHERALSCPU

HARDWARE

APPLICATION SOFTWARE

SYSTEM SOFTWARE

SOFTWARE

It refers to the set of programs that governs the operations of a computer system and make the hardware to work. It controls the internal operations of the computer system.

The system software can be divided into two types:

Operating system Language translator Device drivers System utility

6. What is an assembler?An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language.

7. What are the uses of http protocol? Hypertext Transfer Protocol Secure (HTTPS) is a widely used communications protocol

for secure communication over a computer network, with especially wide deployment on the Internet.

HTTP protocol used for communication between web browsers and web servers .

8. What are the differences between webpage and website?A Webpage is a single page of information, just like a piece of paper. However, it is just that: a single piece of paper. People can browse other pages, but that gets into the Website aspect:

A Website is a network of webpages interlinked to each other, like a book. A Website can consist of many webpages, ranging from multiple topics. Visitors can browse a website and go on multiple pages and do multiple things, like browse the blog, find the latest trends, see the prices, and contact the company.

9. What is meant by pseudo code?Pseudo means imitation and code means instructions, written in a programming language. Pseudocode is the generic way of describing an algorithm without the use of any programming language – related notations. It is the outline of a program, written in a form, which can easily be converted into real programming statements.

10.Compare and contrast flowchart and algorithm.

An algorithm is a description of how to carry out a process. An algorithm lists the steps that must be followed to complete the process. A flowchart consists of a sequence of instructions linked together by arrows to

show the order in which the instructions must be carried out. Flowcharts are often used to describe in detail algorthms that will be carried out

by a computer.

11.Draw the flowchart to multiply 2 numbers.

12.What is meant by explicit conversion?Explicit type conversion is a type conversion which is explicitly defined within a program (instead of being done by a compiler for implicit type conversion).Example :Consider the code:float a = 5.25;int b = (int)a; /*Explicit casting from float to int. The value of b here is 5*/

13.Distinguish between operator and operand.Operator:Operation to be performed on data that yields a value.Operand:Data item on which operators perform the operations.

14.What is the difference between local and global variables? Local Variables Global Variables

These are private to the function in which

they are declared.

Variables that are both alive an active

throughout the entire program.

They are declared inside the function. These are declared outside the function.

We can use the same variable name in

different function in the same program.

It can be accessed by any function in the

program.

15.How will you view the formatting toolbar visible in ms word window?

The Format toolbar is a bar with buttons that offer quick mouse shortcuts for commands that help in refining the aesthetic aspects of the Graph view. It can be made invisible using the toggle command Toolbar / Format on the View menu.

16.List out the various types of constant in c. 1. Numeric constant- It can be further classified into integer and real constants. 2. Character constant –It can be further classified into single character constant

and string constant.17.What is recursion?give its applications.

A function calling itself is called recursion . It can be applied in Recursive descent compilation, chess game designing etc….

18.State the differences between structures and union.Structure:

1. It allocates memory equal to sum of memory allocated to its each individual member.2.Each member have their own memory space.3. Structure cannot be implemented in shred memory.4. It has less Ambiguity.5. Self-referential structure can be implemented in data structure.6. All members if structure can be accessed at a time.Union:1.It allocates piece of memory that is Large enough to hold the Largest variable of type in union.2. One block is used by all the members of union.3. Union is the Best environment where memory is shared.4. As memory is shared, Ambiguity is more in union.5. Self ref. Union can not be implemented.6. Only one member is accessed at a time.

19.What are the various string handling functions? The string handling functions in’C’ language is

a. strcat ( )b. strcmp ( )c. strcpy ( )d. strlen ( )

20.What are the advantages of pointers?The main advantages of using pointers are1.) Function cannot return more than one value. But when the same function can modify many pointer variables and function as if it is returning more than one variable. 2.) In the case of arrays, we can decide the size of th array at runtime by allocating the necessary space. 3.) In the case of pointers to classes, we can use polymorphism and virtual classes to change the behavior of pointers to various types of classes at runtime

PART-B (5*12=60 MARKS) ANSWER ANY FIVE QUESTIONS

21.With a suitable diagram explain about computer organization.

22. Explain briefly about the following classes of computers

A) Mainframe computers Mainframe computer is larger, faster and more expensive than

other general purpose computers These are used to handle huge volumes of data Their word length may be 48 to 64 bits The hard disk capacity lies in the range of 1000 to 10 GB and

processing speed 30 to 100 MIPS

B)Super computers They have a high processing speed

Their processing speed lies in the range of 400 to 10,000 MIPS Word length have the capacity is 1000 MB and machine cycle

time 4 to 6 ns.

23.Explain in detail about the software development steps.Development cycle of a program includes the following phases

Analyze / define the problem Task analysis Designing phase Testing the algorithm for accuracy Coding Test and debug the program Documentation

Analyze / define the problem:

The problem is analyzed precisely and completely. The developer knows about the scope within the problem needs to be analyzed.

Task analysis:

After the problem, the developer needs to develop various solutions to solve the given problem. The optimum solution is chosen, which can solve the problem comfortably and economically.

Designing phase:

After selecting the appropriate solution, algorithm is developed to depict the basic logic of the selected solution. An algorithm depicts the solution in logical steps. Algorithm is represented by flowcharts pseudo codes. These tools make program logic clear and they eventually help in coding.

This phase is also known as design phase

Testing the algorithm for accuracy:

Before converting the algorithms into actual code, it should be checked for accuracy. The main purpose of checking algorithm is to identify major errors at an

early stage, because logical errors are often difficult to detect and correct at later stages

Coding:

The actual coding of the program takes place in the chosen programming language. Depending upon application domain and available resources, a program can be written by using computer language of different levels such as machine, assembly or high level language

Test and debug the program: A program compiler and programmer designed test data machine tests the code for syntax errors. The results obtain are compared with results calculated manually from this test data. Depending upon the complexity of the program, several rounds of testing may be required

Documentation and implementation:

Once the program is free from all the errors, it is the duty of the program developers to ensure that the program is supported by suitable documentation. After documentation, the program is installed on the end user’s machine

24. Briefly explain about the internet terminologies namely LAN,WAN,MODEM,DNS,IP address and FTP.Local Area Networks (LANs):A local area network (LAN) is a computer network covering a small geographic area, like a home, office, or group of buildings.Wide Area Networks (WANs):

Wide Area Network (WAN) is a computer network that covers a broad area (i.e., any networkwhose communications links cross metropolitan, regional, or national boundaries). Or, lessformally, a network that uses routers and public communications links.

The largest and most well-known example of a WAN is the Internet. WANs are used to connect LANs and other types of networks together, so that

users andcomputers in one location can communicate with users and computers in other locations.

Modem:Modulator/demodulatorA device that converts analog signal to digital(modulation) and vice versa (demodulation)

Speed: 1200/2400/9600 bps 14.4/28.8/33.6 Kbps 56 KbpsDNS:The “Domain Name System”– Created in 1983 by Paul Mockapetris (RFCs1034 and 1035), modified, updated, and enhanced by a myriad of subsequent RFCs.

• What Internet users use to reference anything by name on the Internet.• The mechanism by which Internet software translates names to addresses and vice versa.

An address is how you get to an endpoint– Typically, hierarchical (for scaling):• 950 Charter Street, Redwood City CA, 94063• 204.152.187.11, +1-650-381-6003

• A “name” is how an endpoint is referenced– Typically, no structurally significant hierarchy

• “David”, “Tokyo”, “itu.int” • A lookup mechanism for translating objects into other objects • A globally distributed, loosely coherent, scalable,reliable, dynamic database • Comprised of three components • Users generally prefer names to numbers • Computers prefer numbers to names • DNS provides the mapping between the two

– I have “x”, give me “y”• DNS is NOT a directory service

– No way to search the database• No easy way to add this functionality

– A “name space”– Servers making that name space available– Resolvers (clients) which query the servers about the name space

IP address:

A way to identify machines on a network A unique identifier Used to connect to another computer Allows transfers of files and e-mail IP addresses consist of four sections Each section is 8 bits long Each section can range from 0 to 255 Written, for example, 128.35.0.72 These four sections represent the machine itself and the network it is on The network portion is assigned. The host section is determined by the network administrator 5 Classes of IP address A B C D and E

o Class A reserved for governmentso Class B reserved for medium companieso Class C reserved for small companieso Class D are reserved for multicastingo Class E are reserved for future use

FTP: File Transfer Protocol (FTP) is the standard mechanism provided by

TCP/IP for copying a file from one host to another. Although transferring files from one system to another seems simple

and straightforward, some problems must be dealt with first. FTP works on the client/server principle. A client program enables the

user to interact with a server in order to access information and services on the server computer.

Files that can be transferred are stored on computers called FTP servers. To access these files, an FTP client program is used. This is an

Interface that allows the user to locate the file(s) to be transferred and initiate the transfer process.

There are two modes of transfer in FTP: o ascii and binary.

ASCII is used only for files saved in ASCII format(this includes Postscript files)

Binary is used for files that are formatted and saved using a word processing software likeWordPerfect (.txt), spreadsheets (.xls), images (.jpg, .gif), and many executable programs (.exe)and videos (.avi).

25.Briefly explain about theA)sequence control structures In a sequence structure, the instructions to be computed simply follow one

another in a logic progression This structure is denoted by writing one action after another, each action on a

line by itself, and all actions aligned with the logic indent The actions are performed in the same sequence (to to bottom) in which they

are writtenB)Selection control structures

A selection structure allows the program to make a choice between two alternate paths, whether it is true or false

The first statement of a selection structure is a conditional state The sequence of steps in the selection path has been carried out, the

paths are rejoined and then the next instruction is carried out The selection structure has only a single entry and a single exit

If the condition is true, action 1 is performed otherwise action 2 will be performed

26. Briefly explain with suitable example for

A) Decision making statements

Decision Making Control Constructs

Conditional Unconditional

Selective Loop goto break continue

For while do-while

Conditional if –else if-else-if switch-case Expression

B)Looping statementsThe loop is defined as the block of statements which are repeatedly executed for certain number of times.

Loop construct:

Sometimes the execution of certain statements need to be repeated until a given condition is satisfied or it may have to be repeated for a known number of times.Such repetitions are carried out by using a llop construct or iterative construct or repetitive construct. C supports the following loop constructs:

For While Do-while

The for loop:

The for loop is another repetitive control structure, and is used to execute set of instructions repeatedly until the condition becomes false. The assignment, incrementation or decrementation and condition checking is done in for statement only, where as other control structures are not offered all these features in one statement.

Syntax:

for(initialize counter; test condition; increment/decrement counter)

{

………….

body of the loop;

…………..

}

for loop has three parts

Initialise counter is used to initialize counter variable.

Test condition is used to test he condition. Increment/decrement counter is used to increment/decrement counter variable.

The while loop:

It is a repetitive control structure, used to execute the statements within the body until the condition becomes false.The while loop is an entry controlled loop statement, means the condition is evaluated first and it is true, then the body of the loop is executed.

After executing the body of the loop, the condition is once again evaluated and if it is true, the body is executed once again, the process of repeated execution of the body of the loop continues until the condition finally becomes false and the control is transferred out of the loop.

Syntax:

while(condition)

{

………….

body of the loop;

…………..

}

The do….while loop :

It is also repetitive control structure and executes the body of the loop once irrespective of the condition, then it checs the condition and continues the execution until the condition becomes false.

Syntax:

do

{

………….

body of the loop;

…………..

} while(condition);

27.Write a C program and flowchart to check whether the given number is a prime or not.

#include<stdio.h> main() { int n, c = 2;  printf("Enter a number to check if it is prime\n"); scanf("%d",&n);  for ( c = 2 ; c <= n - 1 ; c++ ) { if ( n%c == 0 ) { printf("%d is not prime.\n", n);

break; } } if ( c == n ) printf("%d is prime.\n", n);  return 0;

}

28.Write a C program forA) finding the factorial of n number using function.

#include <stdio.h>int main(){ int c, n, fact = 1; printf("Enter a number to calculate it's factorial\n"); scanf("%d", &n); for (c = 1; c <= n; c++) fact = fact * c; printf("Factorial of %d = %d\n", n, fact); return 0;}

B)To check whether the given number is even or odd.#include<stdio.h>main(){int num;printf ("Enter a number to be checked for even/odd: ");scanf ("%d",&num);if (num%2==0){printf ("The entered number is EVEN.\n");}else{printf ("The entered number is ODD.\n");}}

*********