Question Bank CP
Question Bank CP
1. Variables
2. Keywords
3. Compiler
Q.9 Write a program to print ASCII value of characters using format specifiers.
Q.10 Write a C program to calculate and print the area and perimeter of rectangle.
Q.11 Write a program to read the radius of circle and print area of circle.
Q.12 What is the output of following program, if user input value is 8888, 888, 88.
#include <stdio.h>
main()
int a, b, c;
printf(“sum=%d”,a + b + c);
printf(“Cube=%d”,CUBE(4 + 5));
Q.14 Explain in details various functions for reading and writing of characters.
#include <stdio.h>
main()
float x, y, z;
x= a - b / 3 + c * 2 - 1;
y = a – b / (3 + c) * (2 - 1);
z = a – (b / (3 + c) * 2) – 1;
#include <stdio.h>
main()
n=30;
for(; c<=n;c=c+2)
{
s + c;
c++;
printf(“\nsum=%d”,s);
Q.24 Write a c program to print following structure using ‘nested for loop’-
*****
****
***
**
Q.26 Write a c program using while, do-while, and for loop to add sum of odd and even
numbers.
****
****
****
****
Q.29 Write a program to find largest number among three numbers and draw its flow chart.
main()
int num = 2;
num+ = 8;
printf(“num=%d”,num);
num- = 3;
printf(“num=%d”,num);
num*=2;
printf(“num=%d”,num);
num/=2;
printf(“num=%d”,num);
void main()
int ch;
ch=getchar();
putchar(++ch);
ch++;
putchar(ch++);
printf(“\n”);
putchar(ch);
--ch;
putchar(ch--);
putchar(ch);
Q.33 What is mean by Array? Explain single dimensional array with its advantages and
example.
Q.34Write a program to find largest and smallest number in an array of ten integer numbers.
Q.38 Write a program in C to read n number of values in an array and display them in reverse
order.
Q.40 Write a program in C for 2D array of size 3*3 and print the matrix.
Q.41 List and explain different string handling function with suitable
example.
characters.
Q.44 Explain strlen() and strcpy() function with their syntax and example.
Q.45 Explain strlcmp() and strcat() function with their syntax and
example.
Q.46 Explain strchr() and strstr() function with their syntax and example.
Q.47 Write a C program to count the character ‘a’ that appears in the
order.
Q.54 Explain indirection (*) operator and address (&) operator with suitable example.
Q.56 What is pointer? What kind of information does the pointer variable represent? Explain
different uses of pointer.
Q.63 Write a C program to design a function sum which calculate addition of two integer
numbers.
p1=&a;
p2=&b;
*p1=15;
*p2=35;
*p2=(*p1)++….;
#include<stdio.h>
void main()
{
int x=100;
change(&x);
printf(“x=%d”,x);
*y=*y+200;
#include<stdio.h>
Main()
int i, j, *ptr;
I=10;
ptr=&i;
j=*ptr;
*ptr=20;
#include<stdio.h>
main()
char text[]=”Welcome”;
int num[]={10,20,30,40,50,60,70,};
int i;
i. int *px;
ii. int *p[10];
iii. int func(int *num[])
iv. int p(char *a);
v. int (*p(char *a))[10];
Q.70 Write a program to copy a file into another file using fputs() and fgets() functions.
Q.75 What is union? Differentiate the difference between structure and union.
Q.78 Write a C program to design a function factorial which calculate factorial of N number.