*Write answers with
program whenever necessary.
Ø Draw the block diagram of computer
system and explain it.
Ø Write an algorithm to find out
factorial of a given number also draw flow chart.
Ø Explain various symbols used in
flowchart.
Ø Difference between
·
Hardware
and software
·
Compile
and interpreter
Ø Explain Basic structure of C program.
[B-4EPG13]
Ø Justify C is middle leve language.
Ø Explain ‘C’ development life cycle
using flowchart in detail. [B-4EPG15]
Ø What is data type? List types of data
type & explain any one. [B-4EPG31]
Ø Explain various operators used C
language. [B-4EPG52]
Ø Explain type conversions in
expression or explain implicit and explicit type conversion. [B-4EPG68]
Ø List decision making statement with
IF statement and explain any one. [B-4EPG114]
Ø Explain switch…case statement with
example. [B-4EPG129]
Ø Explain difference between while and
do while statement. [B-4EPG154]
Ø What is looping? Explain FOR loop in
C language.
Ø What is an array? List different
types of an array and explain anyone with example.
Ø What is string? List string handling
functions and explain each. [B-4EPG244-250]
Ø What is user define function? Explain
various category of function. [B-4EPG274]
Ø Explain scope, visibility and
lifetime of variable.
Ø Explain various function calls in C
language.
Ø What is structure and give an example
of a structure? Differentiate structure and union.
Ø What is pointer? How initialize the
pointer? Explain its advantage.
Ø Explain with example
·
Call
by value
·
Call
by reference
Ø Explain various file management
functions in C. [B-4EPG390]
or
Explain various file operations in C.
Explain following terms and functions in brief.
Operating system,
compiler, interpreter, global variable, header files, break, continue, goto
statement,recursion.
getch(), putch(), gets(),
puts(), strcpy(), strcat(), strcmp(), strstr(),
PROGRAMS
Ø Factorial of a number
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a,sum=1;
clrscr();
printf("enter the integer number.=");
scanf("%d",&n);
for(a=1;a<=n;a++)
{
sum=a*sum;
}
printf("factorial
of %d is %d",n,sum);
getch();
}
Ø Prime number
#include<stdio.h>
#include<conio.h>
void main()
{
int
i,j,n,flag;
clrscr();
printf("enter
the no.");
scanf("%d",&n);
for(i=3;i<=n;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
{
flag=0;
break;
}
else
{
flag=1;
}
}
if(flag==1)
printf("\n%d",i);
}
getch();
}
Ø Armstrong number
#include<stdio.h>
#include<conio.h>
void main();
{
int
num,sum=0,temp,rem;
clrscr();
printf("enter
an integer");
scanf("%d",&num);
temp =num;
while(temp!=0);
{
rem=temp%10;
sum=sum+rem*rem*rem*rem;
temp=temp/10;
}
if(number==sum)
printf("number is an armstrong
number\n");
else
printf("number is not armstrong
number");
}
Ø Call by value and call by reference
(As per tutorial No 9.1)
Ø Structure (As per tutorial No 11)
Ø Design patterns
*
* *
* * *
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,m;
clrscr();
printf("enter
the no.=");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
1
2 2
3 3 3
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("enter the no.=");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(k=1;k<=n-i;k++)
{
printf("
");
}
for(j=1;j<=i;j++)
printf("%d ",i);
printf("\n");
}
getch();
}
1
A B
1 2 3
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,j,k,a;
clrscr();
printf("enter the no.=");
scanf("%d",&n);
for(j=1;j<=n;j++)
{
for(k=n;k>=j;k--)
{
printf(" ");
}
a=65;
for(i=1;i<=j;i++)
if(j%2==0)
{
printf("%c ",a);
a++;
}
else
{
printf("%d ",i);
}
printf("\n");
}
getch();
}
And see programs for
another kinds of design patterns.
Ø Also practice for find output from program.
1.
main()
{
int n=6,t=1;
for(;n<10;n=n+2)
printf("%d %d\n",n,++t);
getch();
}
OUTPUT: 6 2
8 3
2.
main()
{
int a=3,b=5,c,*p,*q;
clrscr();
p=&b;
q=&a;
c=*p%*q;++(*p);
printf("%d %d\n",*p,*q);
printf("\n%d%d",c,b);
getch();
}
OUTPUT: 6 3
26
3.
main()
{
int a=3,b=5,c,*p,*q;
clrscr();
p=&b;
a=&a;
c=*p%*q;++(*p);
printf("%d %d\n",*p,*q);
printf("\n%d%d",c,b);
getch();
}
OUTPUT: NO OUTPUT,because error occurred in a
program so program is not compiled and not execute.
Error : nonportable pointer
conversion
4.
main()
{
int x=15,y;
clrscr();
y=x++;
printf("%d
%d\n",++y,x++);
getch();
}
OUTPUT: 16 16
5.
void main()
{
int i;
for(i=5;i<15;i++)
{
printf("%d\n",i);
i=i-1;
}
getch();
}
OUTPUT : infinite times 5 should be print
5
5
5
5…
BEST
OF LUCK