Q1. What Is The Purpose of The Programming? Ans - If We Want To Communicate A Computer Then We Should Go For Programming Language
Q1. What Is The Purpose of The Programming? Ans - If We Want To Communicate A Computer Then We Should Go For Programming Language
Q1. What Is The Purpose of The Programming? Ans - If We Want To Communicate A Computer Then We Should Go For Programming Language
Execution of low level language is fast as compare to all types of programming language
2. Middle Level
it support some features of low level language and high level language
Example: C C++
3. high level
This is slow as compare to low level and middle level programming language
High level language does not interact hardware directly. it can interact with other component like JVM
in java, PVM in python
-------------------------------------------------------------------------------------------------------------------------------------
Ans-->A procedural language is a computer programming language that follows in order, a set
commands Example of procedural programming language are
Procedural language are some of the common types of programming language used by script and
software programming variables, data type, conditional statement, function to create programs that
allows a computer to calculate and display output.
1. System Software(OS)
2. Application Software()
1.System Software: System software controls a computer internal functioning through an operating
system and also control monitors, printers and storage devices.
2. Application Software: An applications is any program, or group of programs that is designed for the
end user. Application software also called End-user software
After Algol 1967 new languages developed by Martin Richards BCPL(Basic Combined programming
language)
---------------------------------------------------------------------------------------------------------------------------------
Ans-->
1. Documentation section
/*
*/
if we are use any pre-defined function in our program then we include below header file
#include<stdio.h>
#include<conio.h>
output function
printf()
puts()
putchar()
input function
scanf()
gets()
getchar();
clrscr();
getch();
//Global Function
//Function Declare
// Function Definition
//class
4. void main(){
//local variable
clrscr();
//Executable code
getch();
-----------------------------------------------------------------------------------------------------------------
1. documentation section
2. Include Section
4. void main()
------------------------------------------------------------------------------------------------------------------------------
1. Turbo C++
2. Dev C++
3. Code Block
-------------------------------------------------------------------------------------------------------------------------------
Hello World
// This is My First Program using c
#include<stdio.h>
void main(){
printf("Hello World");
auto
break
case
char
continue
default
do
int
float
double
else
if
while
goto
for
sizeof
long
struct
switch
enum
union
return
typedef
void
signed
unsigned
2. space
Ans-->identifier is a name given by the programmer it may be name of variable, name of function, name
of array, name of pointer, name of structure, name of class, name of object
int num;
1. Identifier name can be combination of alphabet and digits. but always starts with an alphabet
for example
int 123num;//invalid
int num123;//valid
int num@123;//invalid
int 45;//invalid
int num-123;//invalid
int num_123;//valid
int _123;//valid
int FOR;//valid
int for;//invalid
Q3. Explain static typed programming language and dynamic typed programming
language?
Ans-->
int a, b, c;
a=10;
b=20;
c=a+b;
a=10;
b=20;
c=a+b;
Ans-->Data type can specify what type data can be occur and how many bytes
memory could be allocated
1. int
2. float
3. double
4. char
1. int: if we want to store fixed number whole number then we should go for int
data type
9/2=4
Size in memory
16-bit complier
int 2 byte
32-bit compiler
int 4 byte
Range:
16-bit compiler
-32768 To +32767
32-bit compiler
-2,147,483,648 To +2,147,483,647
format Specifier
int %d or %i
-------------------------------------------------------------------------------------------------------------
2. float : if we want to store real number upto 7 decimal places then we should go
for float data type
size in memory
float 4 byte
format Specifier
float %f
float x=9.0/2;
-------------------------------------------------------------------------------------------------------------
Example: amount
size in memory
double 8 byte
format Specifier
double %lf
double x=9.0/2;
------------------------------------------------------------------------------------------------------
4. char : if we want to store single alphabet then we should go for char data
'1'---------->char
'A'--------->char
size in memory
char 1 byte
format Specifier
char %c
-------------------------------------------------------------------------------------------------------------
Properties:
int num;
Properties:
variable name=value
num=25;
if we want to print value of any variable then we should go for printf() function
Addition: 30
------------------------------------------------------------------------------------------------------------
Area of Circle
Circumference
------------------------------------------------------------------------------------------------------------
Ans--> if we want to display only string or multiple character on the screen then
we should go for puts
Q4. write a c program to print your introduction on the screen without using
printf()
Hello I am ram
i am from bhopal
Ans-->if we want to print char by char on the screen then we should go for
putchar function
Q4. write a c program to print LNCT on the screen without using printf() and
puts()
LNCT
Q5. Explain scanf function in c programming?
Ans-->if we want to take input (any type) form the user then we should go for
scanf function
In c Programming, scanf() is one commonly used function to take input from the
user. The scanf function reads formatted input from the input device keyboard
Enter Length : 4
Enter Breadth :5
Area Of Rectangle : 20
Parameter of Rectangle: 18
Q2. write a c program to take input radius from the user and calculate area and
circumference of the circle.
Area:
Circumference:
Q2. write a c program to take grade of employee from the user and print it on the
user
Grade OF Employee: A
Q1. Explain Operator in c programming?
in below example
10+20
int a,b,c;
a=10;
b=20;
c=a+b;
Example: +,-,*,/,%
2. Unary Operator: It takes one operand at a time and perform some specific
operation
Example: i++,i--,sizeof(),~,!
3. Ternary Operator: It takes three operand at a time and perform some specific
operation
10>20?10:20;
-----------------------------------------------------------------------------------------------------------
Q2. Explain on the basis of functionality how many types of operators available in
c programming
1. Arithmetic Operator[+,-,*,/,%,++,--]
4. Bitwise Operator[&,|,~,<<,>>,^]
5. sizeof
7. Assignment Operator[=,+=,-=,*=,/=]
8. Comma operator(,)
-------------------------------------------------------------------------------------------------------------
-
Syntax:
23%5------------>3
10%4------->2
--------------------------------------------------------------------------------------------
23/5======>4
10/4------>2
Q1. write a c program to find reminder of any number.
Ans-->
#include<stdio.h>
void main(){
int a,b,c,d;
a=5;
b=10;
d=--b; //pre-increment
Ans-->
>
<
>=
<=
==
!=
Ans--> if we want to combine more than one conditions then we should go for
logical operator
2. Logical or (||)
Ans-->Result of logical and (&&) operator is true(1) when all conditions under
consideration are true(1).
Result of logical and (&&) operator is false(0) when one or all conditions under
consideration are false(0).
logical and(&&)
A B A&&B
1 0 0
0 1 0
0 0 0
1 1 1
Q8. Explain Logical || operator in c programming?
Ans-->Result of logical OR (||) operator is true(1) when one or more than one
conditions under consideration are true(1)
logical OR(||)
A B A||B
1 0 1
0 1 1
0 0 0
1 1 1
Q3. Explain logical not(!) operator in c programming?
Ans-->it is used to check the opposite result of any given test conditions. if any
condition result is non-zero(true) it returns 0 that is false.
A !A
1 0
0 1
Q1. Explain bitwise operators in c programming?
2. Bitwise OR (|)
A B A&B
1 0 0
0 1 0
0 0 0
1 1 1
Example:
5----> 0 1 0 1
6----> 0 1 1 0
5&6--->4 0 1 0 0
Q2. Explain bitwise OR(|) Operator in C programming?
Ans-->Result of bitwise or (|) operator is 1 when one or both bits are 1.
Bitwise | Operator
A B A|B
1 0 1
0 1 1
0 0 0
1 1 1
Example:
5----> 0 1 0 1
6----> 0 1 1 0
5|6--->7 0 1 1 1
Q3. Explain bitwise not (~) operator in c programming?
Ans-->
A ~A
1 0
0 1
Example:
128 64 32 16 8 4 2 1
0 0 0 0 0 1 0 0
1 1 1 1 1 0 1 1
1 means negative
0 means positive