Vous êtes sur la page 1sur 19

Q1. What is computer? What are different types of computer?

Ans. Computer is an electronics machine that performs arithmetical and logical operations
with great speed and accuracy.
It takes data or information as input through input devices processes it the result as
the output through output devices.

Types of computer

Analog computer
computer

Micro
Computers
Computers

digital computer

Mini

Mainframe

Computers

Computers

hybrid

Super

ANALOG COMPUTER: It takes data as variables directly from management instrument.


These are used for measuring parameter that very continuously in very real time.
EX. Temperature, Pressure, Voltage, Current etc
DIGITAL COMPUTER: It takes the data as combination of 0 and 1 as off and on respectively it
is based on the concept of binary digit system.
EX. Computers which are used at homes and offices.
HYBRID COMPUTERS: These are the combination of both analogue and digital computer it
can process both descriped and continuous data.
EX. Processor at petrol pumps, in ICU in hospital and in defence etc.

Q2. What is software and different types of software?


Ans. SOFTWARE: The logical parts of a computer system that cannot be seen and touched
are called Software.
SYSTEM SOFTWARES: The software that is design for the system is called system software.
UTILITY SOFTWARES: These are the software that can be designed in increase the
performance and efficiency of the computers
Applications software these are the software designed for the use of system. These
are oriented software.
Computer

Hardware

CPU

Software

Peripheral
Devices

ALU

CU

System

Utility

Software

application

Software Software

MU
Input
Devices

output
Devices

storage
Devices

Operating systems

Single user OS

Multiuser OS

Computer written
Software

Software
packages

Translators

Assembler

Interpretor

Compiler

Q3. Describe following


I) ROM
II) RAM
III) Decision control statements
IV) Primary data types
Ans. ROM:
i) It stands for read only memory.
ii) It is the permanent storage of the computer.
iii) It is non volatile in nature.
iv) Programmes are store care at the time of devices manufacturing.
v) Data store care cannot be modified or deleted.
RAM:
I) Ram stands for random access memory.
II) It is volatile in nature.
III) It is the temporary storage of the computer.
IV) Data store here can be lost in case of power cut.
V) When input is given data first comes in RAM.
Decision control statements:
These are the statement that govern the flow of control in a c programme
Types of control statement

Sequential Statement

IF statement

Selection statement

Switch case statement

Looping statement

While loop

do-while loop

for loop

Primary data types:


Data types

Format specifaier

Storage space

Chrector (chr)

%c

1 Byte

Integar (int)

%d

2 Byte

Float

%f

4 Byte

Double

% lf

8 Byte

Void

0 Byte

Print f: This is known as the output function in a c programme. It is used to print the
message or to display the value of the variable as the output.
Scan f: This is known as the input function in a c programme it is used to take or enter the
data by the user.

Q4. Explain Output and input devices with five examples each?
Ans. INPUT DEVICES: The devices that are used to enter or input the data in a computer
is known as input devices.
EX.
1) Keyboard
2) Mouse
3) :Light pen
4) Scanner
5) Joy stick

OUTPUT DEVICES: The devices that are used to give or display a result as the output
are known as output devices.
Eg.
1) Monitor
2) Printer
3) Plotter
4) Speaker
5) Projector

Q5. What is c language? Explain features of c language?


Ans. C language was developed by Dennis Ritchie at bell Laboratory U.S.A in 1972. It is
general purpose programming language. It is based on the concept of procedures
programming language. It is most commonly used language because of its principles.
C is called middle language because it combines the power of high level
language with the flexibility of high level language.
FEATURES OF C LANGUAGE:
1) C is structural programming language.
2) C is case sensitive in nature.
3) It is machine independent and highly portable language.
4) C language is easy to learn as it has only 32 keywords.
5) It is provisional programming language.

Q6. Accept two numbers by the user and print their sum?
Ans.
#include<stdio.h>
void main()
{
int a,b,c;
printf(enter the two numbers);
scanf(%d%d,&a,&b);
c=a+b;
printf(the sum is %d,c);
}

OUTPUT:
enter the two numbers

2
4
The sum is 6

Q7. Accept two numbers and print the largest?


#include<stdio.h>
void main()
{
int a,b;
printf(enter the two numbers);
scanf(%d%d,&a,&b);
if(a>b)
{
printf(the largest number is %d,a);
}

else
{
printf(the largest number is %d,b);
}
}
OUTPUT:
enter the two numbers
12
24
the largest number is 24

Q8. Accept any number from the keyboard and print the number is odd or even?
Ans.
#include<stdio.h>
void main()
{
int a;
printf(enter the number);
scanf(%d,&a);
if(a%2==0)

{
printf(the number is even);
}
else
{
printf(the number is odd);
}
}
OUTPUT:
enter the number
44
The number is even

Q9. Accept principal amount time and interest rate and calculate and print simple
interest?
Ans.
#include<stdio.h>
void main()
{
int p,r,t;

float si;
printf(enter the principal, rate and time);
scanf(%d%d%d, & p, & r, & t);
si=(p*r*t)/100;
printf( simple interest is %f, si);
}
OUTPUT:
enter the principal,rate and time
5000
10
10
Simple interest is 5000

Q10. Accept employee salary, if HRA is 35%, DA is 57% of the employee salary then
calculate and print gross salary of employee?
Ans.
#include<stdio.h>

void main()
{
int s, d, h, t;
printf(enter the salary);
scanf(%d,&s);
d=s*57/100;
h=s*35/100;
t=s+d+h;
printf(the new salary is %d,t);
}

OUTPUT:
enter the salary
8000
the new salary is 15360

Q11.To accept the radius of the circle and print the area of it?

Area of circle = 3.14*r*r


Ans.
#include<stdio.h>
void main()
{
float r,a;
printf(enter the radius of circle);
scanf(%f,&r);
a=3.14*r*r;
printf( area of the circle is %f, a);
}
OUTPUT:
the radius of circle is 10
Area of cirlcle is 314

Q12. Print the table of 2 using loop


Ans.
#include<stdio.h>
void main()
{
int i=1,j=0;
while(i<=10)
{j=2*i;
printf("%d",j);
i++;
}

}
OUTPUT:

2
4
6
8
10
12
14
16
18
20

Q13. Accept two numbers and calculate and print their sum and difference,
multiplication and division using switch case statement?
Ans. #include<stdio.h>
void main()
{
int a, b,ch;
float c;
printf(enter the two number);
scanf(%d%d, & a, & b);
printf("1=Addition");
printf("2=Subtraction");
printf("3=Multiplication");
printf("4=Division");
printf("Enter your choice");
scanf("%d",&ch);
switch(ch)
{
case 1:
c=a+b;
printf(sum is %f, c);
case 2:
c=a-b;
printf( subtraction is %f, c);
case 3:
c=a*b;
printf( multiplication is %f, c);
case 4:
c=a/b;
printf( division is %f,c);

default:
printf(invalid choice);
}
OUTPUT:
The two number are 2 and 4
The choice is 1
The sum is 6

Q14. Accept a year by the user checked and print year is leap or not?
Ans.
#include<stdio.h>
void main()
{
int y;
printf( enter the year);
scanf(%d, & y);
if (y%4==0)
{
printf( year is leap year);
}
else
{
printf( year is not a leap year);
}
}
OUTPUT
Enter the year
2015
year is not a leap year

Q15. Accept employee salary


If salary is less than 15000 then print EMPLOYEE IS CLERK,
If salary is > 15000 then print EMPLOYEE IS LECTURER and
If salary is > 30000 then print EMPLOYEE IS PROFESSOR.
Ans.
#include<stdio.h>
void main()
{
int s;
printf(enter the salary);
scanf(%d, & s);
if (salary >30000)
{
printf("Employee is a Professor");
}
else
{
if(salary>15000)
{
printf("Employee is a Lecturer");

}
else
{printf("Employee is a Clerk");
}
}
}
OUTPUT:
the salary is 50000
The employee is professor