1.1 ARRAY
1). What is an array?
2). How to declare the array?
3). why array index starts with 0?
4). how to convert array notation to pointer notation?
5). what is advantage of 2'd array?
6). WAP to collect twin primes between 1-100?
7). WAP to hold array address and to print the array elements?
8). WAP to sort the array by using bubble and selection?
9). WAP to reverse the array?
10). WAP to copy contents from one array to another?
1.2 COMPILATION STAGES
1). what is compilation?
2). what are the compilation stages are available in c?
3). what are the modifications will happen in preprocessing stage?
4). what is the diff between object file and exe file?
5). weather .exe file is relocatable or not?
6). WAP to produce the preprocessing stage output?
7). WAP to produce the compilation stage output?
8). WAP to express where syntactical errors will be caught?
9). What will happen if there is no proper header file in code?
10). who will provide the external linkages to code?
1.3 CONDITIONAL STATEMENTS
1). what are the conditional statements are available in c?
2). what is the use of else if ladder?
3). why switch is better the else if?
4). what is use of nested conditional statements?
5). what is syntax of if else?
6). WAP in menu driven way to collect and to print the details of employ?
7). WAP to convert switch into else if?
8). WAP to find the day with the help of year, date, month?
9). WAP to find the greatest number among 2 numbers by using ternary?
10). WAP to solve nested conditions with ternary?
1.4 CONDITIONAL AND CONTROL STATEMENTS
1). What are the control statements are available in c?
2). what are the 3 principal components of control statements?
3). what is advantage and syntax of each control statements?
4). what is the exit and entry-controlled loop in c?
5). what is the concept which can overlap the loops?
6). WAP to implement Diamond pattern?
7). WAP to print 1-100 prime, even, odd numbers?
8). WAP to find the product of digits in each number?
9). WAP to collect multiple inputs and to print those?
10). implement the alpha numerical pattern with do while?
1.5 DATA TYPES
1). What are the different types of data types are available what those are?
2). What is the format Specifies for different types of data types?
3). What are fundamental and derived data types?
4). What are the sign Qualifiers are available in c?
5). What are the Size Qualifiers are available in c?
6). WAP to find the sizes of different data types?
7). WAP to Find the ranges of Different data types?
8). WAP to assign the one type value to another type variable and observe the result?
1.6 DMA
1). What is Dynamic memory allocation?
2). What are the DMA functions are available and syntaxes?
3). What is use of free?
4). what is the location where DMA will allocate?
5). how to free the memory using realloc?
6). WAP to allocate the memory to pointer to access it?
7). WAP to allocate 2'd pointers memory and to hold multiple strings?
8). WAP to allocate memory to structure and access those elements?
9). WAP to allocate memory to multiple 2'd arrays and to hold in 3'd?
10). WAP to allocate memory to different data variables and to access those?
1.7 ENUM
1). What is enum and syntax to declare enum?
2). what are the advantages of enum?
3). What is the size of enum?
4). how to access enum elements?
5). what is the default values of enum?
6). WAP to find the month using enum?
7). WAP to pass enum value and to return the same?
8). WAP to perform arithmetic operations using enum?
9). WAP to copy one enum to another?
10). WAP to increment and decrement the enum variable and observe the result?
1.8 C ENVIRONMENT
1). What are the different types of Compilers in c?
2). What are the different types of ide's are available do develop c?
3). Who invented c?
4). What is the purpose of invention of C?
5). C is high- or low-level language?
6). C is case sensitive or not?
7). c is procedure oriented or not?
8). what are all the fields c will be used?
9). difference between c and c++?
10). c was developed with which language?
11). how to install c-based compiles and ide's?
12). what is the use of c in high level language?
13). Difference between c and low-level language?
14). where c libraries will be stored?
15). what is the out form of c program after compilation?
16). What are the folders will be created after installing c compiler?
1.9 FILE HANDLING
1). what is FILE?
2). how to access the file?
3). what are functions available in file handling?
4). what is syntax and use of fseek()?
5). why file is opeq type of structure?
6). WAP to copy one file content to another?
7). WAP to print source code as output?
8). WAP implement grep command?
9). WAP to implement WC command?
10). WAP to implement ftell()?
1.10 FUNCTIONS
1). what is function?
2). what are the advantages of function?
3). what is the syntax of function?
4). what are the different types of functions what are those?
5). where pre-defined function definitions are available?
6). WAP to find sum, sub, mul, div, mod which will be called in menu driven way?
7). WAP to find given num is Armstrong or not?
8). WAP to find Fibonacci series of given number?
9). WAP to find the multiples of given number?
10). WAP to find given number is perfect number of not?
1.11 OPERATORS
1). What is operator?
2). What are the different types of operators are available and what are those?
3). What is the significance of bitwise operators?
4). what is the output of logical operators?
5). what are miscellaneous operators are available in c?
6). WAP to add 2 numbers without using + operator?
7). WAP to multiply 2 numbers without using * operator?
8). WAP to Evaluate 2 expressions?
9). WAP to perform arithmetic operation on 2 operands by using shorthand operators?
10). WAP to print the binary equivalent of int number?
1.12 POINTERS
1). What is pointer, syntax?
2). What are the advantages of pointer?
3). what is wild pointer?
4). what is NULL pointer?
5). what is generic pointer?
6). what is Dangling pointer?
7). WAP to swap 2 numbers by using call by reference?
8). WAP to implement call back function with function pointer?
9). WAP which will accept 2'd pointer and will return the same?
10). WAP to hold the address of function and to return the function address?
1.13 PREPROCESSOR_DERICTIVES
1). What is the use of preprocessor Directives?
2). what are the different preprocessor directives?
3). In compilation which stage preprocessor directives will be processed?
4). What is the difference between if and #if?
5). What is the real time applications of preprocessor directives?
6). WAP to allocate memory by using #pragma?
7). WAP to Discard piece of code from source file?
8). WAP to explain about #if #elif #endif?
9). What is the command for preprocessing stage?
10). what are the modification will happen in preprocessing stage?
11). what is the difference between macro and inline and function?
1.14 STORAGE CLASSES
1). what is storage class?
2). what are the different types of storage classes are available?
3). what are the advantages of storage classes?
4). what will happen if Static storage class is not working to static variable?
5). if CPU core registers are full where register variables will store?
6). WAP to print the default values of all storage variables?
7). WAP to print the memory locations of each storage class?
8). WAP to access the Global variable in multiple files?
9). WAP to access the Static variable in different file?
10). WAP to demonstrate the Scope rules?
11). what is the memory layout of C?
12). what is scope of local static and global static?
13). what is the visibility of extern variables?
14). what is the default storage class of local variables?
15). what is the default storage class of global variables?
1.15 STRINGS
1). what is string?
2). what are functions available in strings?
3). what is syntax of memmove,memcpy,memset?
4). what is advantage of 2'd strings?
5). what is the header file to be included when using strings?
6). implement strstr?
7). implement strrchr?
8). implement strcmp?
9). implement strncpy?
10). implement strdup?
1.16 STRUCTURE
1). What is structure and syntax to declare the structure?
2). how to find the size of structure?
3). what is structure padding?
4). what is structure packing?
5). what is bitfield concept in structure?
6). WAP to collect the details of students by using structure?
7). WAP to call function by passing structure address and to print those elements?
8). WAP to copy one structure to another?
9). WAP to sort array of structures by using roll number?
10). WAP to implement 2'd structure?
1.17 UNION
1). what is union and syntax of union?
2). What is the difference of Structure and union?
3). how to find the size of union?
4). implement size of function?
5). What are the real time scenarios where union will be used?
6). WAP to collect employee details using union?
7). WAP to initialize the union and to access those elements?
8). WAP to find the address of union elements?
9). WAP to copy the union to structure?
10). WAP to pass union to function and to access those elements?
1.18 VARIABLES
1). What is variable?
2). What is the Syntax of Variable?
3). what is the Advantage of Variable Concept in c?
4). what are the rules to declare and to not declare the variable?
5). what are the different types of variable are available?
6). WAP to declare the variable and to pass the variable to function?
7). WAP to print the address of variable?
8). WAP to Swap 2 variables without temp and with temp variable?
9). WAP to collect values to multiple different types of variables at run time?
10). what is the dis-advantage of variable concept and advantage?
Program #1
#include < stdio.h > int main() { unsigned short int a=0; printf("%hu\n",a); a=a-5; printf("%hu\n",a); }
Program #2
#include< stdio.h > int main() { int a=20,b=10,c; c=a>b>5; printf("%d",c); }
Program #3
#include< stdio.h> int main() { int c; float a=0.3; double b=0.3; c=a==b; printf("%d",c); }
Program #4
#include< stdio.h> int main() { int a=2,b=0,c=4,d; d=(a=b)&&(a=c); //d=(a=b)&&(a=c)||(a=9); printf("%d %d %d %d",d,a,b,c); }
Program #5
#include< stdio.h> int main() { float a=4,b=5; a^=b^=a^=b; printf("%f %f",a,b); }
Program #6
#include< stdio.h> int main() { printf("%u",-2<<1); }
Program #7
#include< stdio.h> int main() { int a; a=1,2,3; printf("%d",a); }
Program #8
#include< stdio.h> int main() { int i; i=1,2,6,6; printf("%d",i); }
Program #9
#include< stdio.h> int main() { //char ch='a'; printf(" %d %d %d",sizeof(1),sizeof('a'),sizeof(1.2)); }
Program #10
#include< stdio.h> int main() { int a=2; printf("%d %d %d %d %d",++a,a++,a++,++a,a); }
Program #11
#include< stdio.h> int main() { int a[10]; printf("%d",*a+1-*a+4); }
Program #12
#include< stdio.h> int main() { int x; x=--3; printf("%d",x); }
Program #13
#include< stdio.h> int main() { int a=2,b=4,c; c=(a>b)?a=2:b=5; printf("%d",c); }
Program #14
#include< stdio.h> enum month{jan,feb=9,mar,apr,may}; int main() { enum month m; m=++feb; printf("%d",m); }
Program #15
#include< stdio.h> enum day {sun=1,mon,tue,wen}; int main() { int d1; printf("%d\t",mon); d1=mon+2; printf("%d\n",d1); }
Program #16
#include< stdio.h> void fun(int, int); int main() { static int x=10,y=20; fun(x,y); printf("x = %d\t y = %d\n",x,y); } void fun( static int s, int t) { printf("%d",s); }
Program #17
#include< stdio.h> int var=9; int main() { int var=7; { int var=18; } printf("%d",var); }
Program #18
#include< stdio.h> int main() { int i,sum=0; for(i=0;i<5;i++) { int i=10; sum=sum+i++; } printf("sum=%d",sum); }
Program #19
#include< stdio.h> int x=89; void fun1(void) { x++; } void fun2(void) { x++; } int main() { fun1(); printf("%d\n",x); fun2(); printf("%d\n",x); }
Program #20
#include< stdio.h> int main() { fun1(); fun2(); } void fun1() { extern int x; x++; printf("%d\t",x); } int x=89; void fun2() { x++; printf("%d\n",x); }
Program #21
#include< stdio.h> int main() { char c='s'; char str1[]="Chandan"; char str2[]="Bhargav"; char const *p=str1; //*p=c; //p = str2; *p='s'; p=str2; printf("%s\n",p); }
Program #22
#include< stdio.h> int main() { int x=6; ++x++; printf("%d",x); }
Program #23
#include < stdio.h> int main() { char *s="Chandra"; int i=0; while(s[++i]) printf("%d\n",i); }
Program #24
#include< stdio.h> int main() { int arr[4]={10,20,30,40}; int *p,x; p=&arr[0]; printf("%d\n",*p); *p++; printf("%d\n",*p); (*p)++; printf("%d\n",*p); ++*p; printf("%d\n",*p); *++p; printf("%d\n",*p); }
Program #25
#include< stdio.h> struct clas { static int a; }; struct clas s; int main() { printf("%d",s.a); }
Program #26
#include< stdio.h> #define prod(x) (x*x) int main() { int i=3,j,k; j=prod(i++); k=prod(++i); printf("%d %d %d %d %d %d",++i,i++,i++,i,++i,++i); printf("%d %d\n",j,k); }
Program #27
#include< stdio.h> #define prod(a,b) a*b int main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
Program #28
#include< stdio.h> #define sqr(x) (x)*(x) int main() { int a,b=3; a=sqr(b+2); printf("%d",a); }
Program #29
#include< stdio.h> #define print(int) printf("%d",int) int main() { int x=2,y=3,z=4; print(x); print(y); print(z); }
Program #30
#include< stdio.h> int main() { printf("Ravi""indra"); }
Program #31
#include< stdio.h> #define MESS junk int main() { int junk=1; printf("%d",MESS); }
Program #32
#include< stdio.h> int main() { struct value { unsigned int bit1:2; unsigned int bit2:2; unsigned int bit4:2; }bit={10,22,68}; printf("%d %d %d\n",bit.bit1,bit.bit2,bit.bit4); }
Program #33
#include< stdio.h> int main() { enum days{m=-1,t,w=6,th,f,s}; w++; printf("%d %d %d %d %d %d\n",m,t,w,th,f,s); }
Program #34
#include< stdio.h> int main() { typedef struct { int a; int b; int c; char ch; int d; } xyz; typedef union { xyz a; char y[100]; }abc; printf("%d %d",sizeof(xyz),sizeof(abc)); }
Program #35
#include< stdio.h> #define abc 20 #define xyz 10 #define xxx abc-xyz int main() { int a; a=xxx*10; printf("%d",a); }
Program #36
#include< stdio.h> int const max=10; void fun() { max++; printf("%d",max); } int main() { enum a {a,b,max}; printf("%d",max); fun(); }
Program #37
#include< stdio.h> #define cube(C) (C*C*C) int main() { printf("%d",cube(1+2)); }
Program #38
#include< stdio.h> int main() { struct tag { unsigned a:1; unsigned b:1; unsigned c:32; }s; printf("%d",sizeof(s)); }
Program #39
#include < stdio.h> #define int char int main() { int a; printf("%d",sizeof(a)); }
Program #40
#include< stdio.h> #define int char int main() { int a; printf("%d",sizeof(a)); }
Program #41
#include< stdio.h> int main() { int a=9,b=0,c=0; if(!a<10&&!b||c) printf("1"); else printf("0"); }
Program #42
#include< stdio.h> int main() { int i=1,j=9; if(i>=5&&j<5) i=j+2; printf("%d\n",i); }
Program #43
#include< stdio.h> int main() { int a=6,b=4; while(a+b) { printf("%d %d",a,b); a=a/2; b=b%3; } }
Program #44
#include< stdio.h> int main() { int a=1,b=0,c=4,d,e; }
Program #45
#include< stdio.h> int main() { int i=2,j=2; while(i+1?--i:j++) { printf("%d",i); } }
Program #46
#include< stdio.h> int main() { int i,j; i=j=2,3; while(--i&&j++) printf("%d %d",i,j); printf("%s","ECE","EEE","EIE"); }
Program #47
#include< stdio.h> int main() { if(printf("ddd")) { printf("i know c"); } else printf("dont"); }
Program #48
#include< stdio.h> int r(); int main() { for(r();r();r()) { printf("%d\t",r()); } } int r() { int static num=7; return num--; printf("%d\n",num); }
Program #49
#include< stdio.h> int main() { //int a=b=c=10; int i=2,j=5,k=3; int a=i&&j>>=k; //int d=i=j=k; printf("%d",a); }
Program #50
#include< stdio.h> int main() { int xyz[10]={5},i=10,j=9; printf("%d %d",xyz[1],xyz[9]); while(printf("0\t")) printf("%d\n",i); }
Program #51
#include< stdio.h> int main() { int a=10; void *p=&a; printf("%d",*(int*) p); }
Program #52
#include< stdio.h> int main() { int jk; jk =1,2; printf("%d",jk); }
Program #53
#include< stdio.h> int main() { int a; printf("a=%d a=%d a=%d",a=2,a=3,a=0); }
Program #54
#include< stdio.h> int main() { int a=5,b; printf("%d %d",a,b); printf("%d>>%d %d>>%d",4>>1,8>>1); }
Program #55
#include< stdio.h> int main() { int a[4]={2,4,8,16},i=3,j=0; while(i) { j=a[i]+j; i--; } printf("%d",j); }
Program #56
#include< stdio.h> int main() { int a[5],i=0; while(i<5) a[i]=++i; for(i=0;i<5;i++) printf("%d ",a[i]); }
Program #57
#include < stdio.h> int main() { int arr[1]={10}; printf("%d",0[arr]); }
Program #58
#include < stdio.h> int main() { int a[5]={5,1,15,20,25},i=0,j,m,k; k=++a[i]; j=a[i]++; m=a[i++]; printf("%d %d %d ",k,j,m); printf("%d %d ",i,j); }
Program #59
#include< stdio.h> int main() { char str[10]="ismindian"; printf("%d %d",sizeof(str+999),strlen(str+3)); }
Program #60
#include< stdio.h> int main() { char s[10]="str"; strcat(s,"ji"); printf("%s",s); }
Program #61
#include < stdio.h> int main() { char a[]="CILU"; printf("%d\n",sizeof(a)); printf("%d\n",strlen(a)); if(printf("%s\n",a)) printf("this is not empty string\n"); else printf("empty string\n"); }
Program #62
#include< stdio.h> int main() { char p[]=" "; p[1]='d'; printf(p,65); }
Program #63
#include< stdio.h> int main() { char s[]="sales\0man\0"; printf("%s",s); }
Program #64
#include< stdio.h> int main() { int a[10]={5}; printf("%d %d",a[1],a[9]); }
Program #65
#include< stdio.h> int main() { char str[]="chandan chandra"; printf("%.10s",str); }
Program #66
#include< stdio.h> int main() { int a,b,c; a=10,b=20; c=printf("%d",a)+ ++b; printf("%d\n",c); }
Program #67
#include< stdio.h> int main() { int x=50,y=75,z=100,a; a=(x+50?y>=85?z>=100?1:2:3:4); printf("%d",a); }
Program #68
#include< stdio.h> int main() { char a[]="hello"; char *b="hello"; char c[5]="hellor"; printf("%d %d %d",sizeof(a),sizeof(b),sizeof(c)); printf("%c",*a++); }
Program #69
#include< stdio.h> int main() { int i=strlen("bluef")+strlen("purple")/strlen("red")-strlen("green"); printf("%d",i); }
Program #70
#include< stdio.h> print(char *s) { if(*s) print(++s); printf("%c",*s); } int main() { char str[]="geneius"; print(str); }
Program #71
#include< stdio.h> static int a=3; int main() { extern int a; printf("%d",a); }
Program #72
#include< stdio.h> #define SWAP(a, b) t=a, a=b, b=t; int main() { int x=10, y=20,z; SWAP(x, y); printf("%d %d\n", x, y); return 0; }
Program #73
#include< stdio.h> int main() { unsigned char a; a=0xff+2; printf("%d ",a); }
Program #74
#include< stdio.h> int main() { FILE *fp; int n; fprintf(fp,"%d",45); }
Program #75
#include< stdio.h> int main() { FILE *fp=stdout; int n; fprintf(fp,"%d",45); fprintf(stderr,"%d",65); }
Program #76
#include< stdio.h> int main() { unsigned char c; FILE *fp; fp=fopen("test.text","r"); while((c=fgetc(fp))!=EOF) printf("%c",c); fclose(fp); return 0; }
Program #77
#include< stdio.h> int main() { char *str="i LOVE c ."; while(*str) { putc(*str,stdout); fputc(*str); printf("%c",*str); str++; } return 0; }
Program #78
#include < stdio.h> int main() { FILE *fp; fp = fopen("newfile", "w"); printf("%d\n", ferror(fp)); return 0; }
Program #79
#include < stdio.h> int main() { int a[2][3] = {1, 2,3, 4, 5}; int i = 0, j = 0; for (i = 0; i < 2; i++) for (j = 0;j< 3;j++) printf("%d ", a[i][j]); }
Program #80
#include< stdio.h> void main() { float k = 0; for (k = 0.0; k < 3.0; k=k+0.1) printf("Hello"); }
Program #81
#include< stdio.h> int main() { int x=40; { int x=20; printf("%d",x); } printf("%d",x); return 0; }
Program #82
#include< stdio.h> int main() { int i = 2, j = 3, k, l ; float a, b ; k = i / j * j ; l = j / i * i ; a = i / j * j ; b = j / i * i ; printf( "%d %d %f %f", k, l, a, b ) ; }
Program #83
#include< stdio.h> int main() { int a, b ; a = -3 - - 3 ; b = -3 - - ( - 3 ) ; printf ( "a = %d b = %d", a, b ) ; }
Program #84
#include < stdio.h> int main() { int c=08; printf("%d",c); return 0; }
Program #85
#include< stdio.h> int main() { char ch=130; printf("%d",ch); }
Program #86
#include< stdio.h> int main() { char d='2'; int i=5; printf("%d\t",sizeof(d)); printf("%d\t",sizeof(++i)); printf("%d",i); return 0; }
Program #87
#include< stdio.h> int main() { int c; int a= sizeof(signed) +sizeof(unsigned); int b=sizeof(const)+sizeof(volatile); printf("%d ",a+b); c=a+++b++; printf("%d ",c); printf("%d ",a); printf("%d ",b); return 0; }
Program #88
#include < stdio.h> int main() { printf("Chandan \r Bhargav \n"); return 0; }
Program #89
#include < stdio.h> int main() { printf("Chandan\r\nCha\nndra\n"); return 0; }
Program #90
#include < stdio.h> int main() { float f1 = 0.1; if (f1 == 0.1f) printf("equal\n"); else printf("not equal\n"); }
Program #91
#include < stdio.h> int main() { float x = 'a'; printf("%f", x); return 0; }
Program #92
#include < stdio.h> int main() { int x = 2, y = 0; int z = (y++) ? y == 1 && x : 0; printf("%d\n", z); return 0; }
Program #93
#include < stdio.h> int main() { int x = 1; int y = x == 1 ? getchar(): 2; printf("%d\n", y); }
Program #94
#include < stdio.h> int main() { int x = 1; short int i = 2; float f = 3; if (sizeof((x == 2) ? f : i) == sizeof(float)) printf("float\n"); else if (sizeof((x == 2) ? f : i) == sizeof(short int)) printf("short int\n"); }
Program #95
#include < stdio.h> int main() { int y = -1, x =0; int l = (x++, y++) ? y : x; printf("%d\n", l); }
Program #96
#include < stdio.h> void main() { int k = 8; int m = 7; int z = k < m ? k++ : m++; printf("%d", z); }
Program #97
#include < stdio.h> int main() { reverse(1); } void reverse(int i) { if (i > 5) exit(0); printf("%d\n", i); return reverse(i++); }
Program #98
#include < stdio.h> void reverse(int i); int main() { reverse(1); } void reverse(int i) { if (i > 5) return ; printf("%d ", i); return reverse(( i++,i)); }
Program #99
#include< stdio.h> int main() { int i=5,b=8; fun(i,++i); } fun(int x) { printf("%d ",x); }
Program #100
#include < stdio.h> int main() { double k = 0.0; for (k = 0.1; k != 3.0; k=k+0.1) { printf("%lf\n", k); } }
Program #101
#include < stdio.h> int main() { int a=5; static int x=a; ++a,++x; printf("%d %d ",a,x); }
Program #102
#include< stdio.h> int main() { struct st { int a:4; int b:3; int c:5; }; struct st s; s.a=15; s.b=9; s.c=6; printf("%d %d %d ",s.a,s.b,s.c); printf("%d \n",sizeof(s)); }
Program #103
#include< stdio.h> int main() { int a=3; a=a++ + ~++a; printf("%d ",a); }
Program #104
#includeint main() { int a=5; b=a++; printf("%d ",a); }
Program #105
#include < stdio.h> int main() { printf("File :%s\n", __FILE__ ); printf("Date :%s\n", __DATE__ ); printf("Time :%s\n", __TIME__ ); printf("Line :%d\n", __LINE__ ); printf("ANSI :%d\n", __STDC__ ); }
Program #106
#include< stdio.h> int main() { int a[5]={10,20,30,40,50},x,*p; p=&a[0]; x=++*p; printf("x=%d *p=%d\n",x,*p); }
Program #107
#include< stdio.h> int main() { int i=510,j=0; printf("%d%c"+3,i); }
Program #108
#include< stdio.h> int main() { int a=5,c; c=++a + ++a; //d=a + ++a; printf("%d %d ",c,a); }
Program #109
#include< stdio.h> #define m(x) x++ int main() { int a=2; printf("%d ",m(a++)); }
Program #110
#include< stdio.h> struct st { int s; }v1; struct st1 { int x; }v2; int main() { v1.s=3; v2.x=v1.s; }
Program #111
#include < stdio.h> int main() { int k; for (k = -3; k < -5; k++) printf("Hello"); }
Program #112
#include < stdio.h> int main() { int i = 0; for (i++; i==1 ; i = 2) printf("In for loop "); printf("After loop\n"); }
Program #113
#include < stdio.h> int main() { int i = 0; for (foo(); i == 1; i = 2) printf("In for loop\n"); printf("After loop\n"); } int foo() { return 1; }
Program #114
#include < stdio.h> int main() { for (int i = 0;i < 1; i++) printf("In for loop\n"); }
Program #115
#include< stdio.h> int a[]; int main() { int i; //printf("%d ",sizeof(a)); for(i=0;i<5;i++) { scanf("%d",&a[i]); } for(i=0;i<5;i++) { printf("%d ",a[i]); } // printf("%d ",sizeof(a)); }
Program #116
#include < stdio.h> static int x = 5; void main() { { int x = 9; { x = 4; } printf("%d", x); } printf("%d", x); }
Program #117
#include < stdio.h> int main() { int i = 0; do { i++; if (i == 2) continue; printf("In while loop "); } while (i < 2); printf("%d\n", i); }
Program #118
#include < stdio.h> int main() { int i = 0, j = 0; for (i; i < 2; i++) { for (j = 0; j < 3; j++) { printf("1\n"); break; } printf("2\n"); } printf("after loop\n"); }
Program #119
#include < stdio.h> void main() { int x = 0; if (x = 0) printf("Its zero\n"); else printf("Its not zero\n"); }
Program #120
#include < stdio.h> int main() { int k = 8; int x = 0 && ++k; printf("%d %d\n", x, k); }
Program #121
#include < stdio.h> int main() { return 1; return 2; }
Program #122
#include < stdio.h> int main() { unsigned int x = -5; printf("%u", x); }
Program #123
#include< stdio.h> #define SWAP(a, b, c) {c t; t=a; a=b; b=t;} int main() { int x=10, y=20; SWAP(x, y, int); printf("%d %d\n", x, y); return 0; }
Program #124
#include< stdio.h> #define MAN(x, y) ((x)>(y)) ? (x):(y); //replacing the data int main() { int i=10, j=5, k=0; k = MAN(++i, j++); printf("%d, %d, %d\n", i, j, k); return 0; }
Program #125
#include< stdio.h> #define SQUARE(x) x*x int main() { float s=10, u=30, t=2, a; a = 2*(s-u*t)/SQUARE(t); printf("Result = %f", a); return 0; }
Program #126
#include< stdio.h> int main() { int a=5; // printf("%d ",sizeof(a=a+1)); printf("%d ",sizeof(++a)); // printf("%d ",sizeof(6.90)); printf("%d ",a); }
Program #127
#include< stdio.h> int main() { int a=10; printf("%d %d %d %d %d",a=50,a=40,a=30,a=20,a=10); }
Program #128
#include < stdio.h> int main() { char *p = NULL; char *q = 0; if (p) printf(" p "); else printf("nullp"); if (q) printf("q\n"); else printf(" nullq\n"); }
Program #129
#include< stdio.h> int main() { int a=56; printf("%f ",a); }
Program #130
#include < stdio.h> int *f(); int main() { int *p = f(); printf("%d\n", *p); } int *f() { int j = 10,k=2; return &(k); }
Program #131
#include < stdio.h> int main() { int *ptr, a = 10; ptr = &a; *ptr += 1; printf("%d,%d \n", *ptr, a); }
Program #132
#include < stdio.h> int main() { int x = 2, y = 0; int z = y && (y = 10); printf("%d\n", y); return 0; }
Program #133
#include < stdio.h> int main() { int k = 0; for (;k;) printf("Hello"); }
Program #134
#include < stdio.h> int main() { int k = 0; for (;k < 3; k++) printf("Hello"); }
Program #135
#include< stdio.h> #include< stdlib.h> int main() { char *p = (char *)malloc(10); printf("%d ",sizeof(p)); return 0; }
Program #136
#include< stdio.h> union emp { int empno; int age; float sal; }; int main() { union emp e = { 25,10,100000}; printf("%d %d %f ", e.empno, e.age,e.sal); return 0; }
Program #137
#include< stdio.h> int main() { float a; scanf("%f", &a); printf("%f\n", a+a+a); printf("%f\n", 3*a); return 0; }
Program #138
#include< stdio.h> int main() { int a=6; static int b=a; b++; printf("%d ",b); }
Program #139
#include< stdio.h> int main() { int a = 5; switch(a) { case 1: printf("First"); case 2: printf("Second"); case 3 + 2: printf("Third"); case 6: printf("Final"); break; } return 0; }
Program #140
#include< stdio.h> int main() { int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1)); return 0; }
Program #141
#include< stdio.h> int main() { int; }
Program #142
#include< stdio.h> int main(int argc, char *argv[]) { printf("%c", *++argv[1] ); return 0; }
Program #143
#include < stdio.h> #define SYSTEM 20 int main() { int a = 20; #if SYSTEM ==20 printf("HELLO "); #endif #if SYSTEM == 20 printf("WORLD\n"); #endif }
Program #144
#include < stdio.h> #define COLD int main() { #ifdef COLD printf("COLD\t"); #undef COLD #endif #ifdef COLD printf("HOT\t"); #endif }
Program #145
#include < stdio.h> struct student { char a[8]; }; int main() { struct student s; printf("%d", sizeof(struct student)); }
Program #146
#include< stdio.h> int main() { int n=5; printf("n=%**d",n,n); }
Program #147
#include< stdio.h> int main() { printf("%d ",-9>>2); }
Program #148
#include< stdio.h> #define m(x,y) x##y int main() { int xy=5,x=6,y=7; printf("%d ",m(x,y)); }
Program #149
#include< stdio.h> int main() { printf("ism\rindian\n"); }
Program #150
#include < stdio.h> int main() { printf("IAM\findian"); }
Program #151
#include< stdio.h> int main() { printf("\a"); }
Program #152
#include< stdio.h> #define max 10 main() { printf("%d ",max*max); }
Program #153
#include< stdio.h> int main() { printf("%dd\n"); }
Program #154
#include< stdio.h> int main() { char a,b; printf("%d ",12); printf("%d ",143); printf("%d ",scanf("%d%d",&a,&b)); }
Program #155
#include< stdio.h> int main() { static int i=10,*j,**k; j=&i; k=&j; j++; printf("i is %u j is %d",&i,j); printf("k is %d",k); getch(); }
Program #156
#include< stdio.h> int main() { printf("india"-'A'+'B'); }
Program #157
#include < stdio.h> int main() { int i=66,x=-3; printf((x>0)?"%d":"%c",i); }
Program #158
#include< stdio.h> int main() { char *name="VasuBabu"; name++; printf("\n %s",++name); ++name; if(name[-2]=='T') printf("%cYES",name[-2]); else printf("NO"); }
Program #159
#include< stdio.h> int main() { int a,b; float f; scanf("%2d%3d%4f",&a,&b,&f); printf("%d %d %f",a,b,f); }
Program #160
#include< stdio.h> int main() { enum number { a=-1, b= 4,c,d,e}; printf("%d",e); return 0; }
Program #161
#include< stdio.h> int main() { int i=0; for(i=0;i<20;i++) { switch(i) { case 0:i+=5; case 1:i+=2; case 5:i+=5; default: i+=4; break; } printf("%d ",i); } return 0; }
Program #162
#include< stdio.h> int main() { unsigned int x=-1; int y; y = ~0; if(x == y) printf("same"); else printf("not same"); printf("%u %d",x,y); return 0; }
Program #163
#include< stdio.h> #include< string.h> #include< malloc.h> int main() { int i; char a[]="String"; char *p="New Sring"; char *Temp; Temp=a; a=malloc(strlen(p) + 1); strcpy(a,p); p = malloc(strlen(Temp) + 1); strcpy(p,Temp); printf("(%s, %s)",a,p); free(p); free(a); return 0; }
Program #164
#include< stdio.h> #include< string.h> char *gxxx() { static char xxx[1024]; return xxx; } int main() { char *g="string"; strcpy(gxxx(),g); g = gxxx(); strcpy(g,"oldstring"); printf("The string is : %s",gxxx()); return 0; }
Program #165
#include< stdio.h> int main() { printf("%d %d %d %d ",-16%5,16%5,-16%-5,-16%-5); }
Program #166
#include < stdio.h> int main() { int a = 0, i = 0, b; for (i = 0;i < 5; i++) { a++; continue; } }
Program #167
#include< stdio.h> int main() { int *p=NULL; printf("%u ",p); }
Program #168
#include< stdio.h> #define dprint(expr) printf(#expr "=%d ",expr) int main() { int x=7; int y=3; dprintf(x/y); }
Program #169
#include< stdio.h> int main() { int i; char *p; i=0X89; p=(char *)i; p++; printf("%x ",p); }
Program #170
#include< stdio.h> int x=0x65; int main() { char x; printf("%d ",x); }
Program #171
#include< stdio.h> int main() { int l=6; switch(l) { default : l+=2; case 4: l=4; case 5: l++; break; } printf("%d",l); }
Program #172
#include< stdio.h> int main() { int i; printf("%d", &i)+1; scanf("%d", i)-1; }
Program #173
#include< stdio.h> int main() { int num = NULL; printf("Value of Number %d ", ++num); return 0; }
Program #174
#include < stdio.h> int main() { int *ptr = NULL; printf("The value of ptr is %u",ptr); ptr++; printf("The value of ptr is %u",ptr); return 0; }
Program #175
#include< stdio.h> int main() { const char *p; char const *ptr; (*p)++; (*ptr)++; }
Program #186
#include< stdio.h> int main() { int a=4,b=6,c; c=a<<2+2<Program #187
#includeint main() { char c=-64; int i=-32; unsigned int u =-16; if(c>i){ printf("pass1"); if(c
Answer 3
EMBEDDED ACTIVITY LAB 1
- Difference between the processor and controller?
- Difference between von Neumann and Harvard architecture?
- Difference between little-endian and big-endian architecture?
- Get the basic knowledge on electronic components?
- Recollect the topics of c programming knowledge?
- Do basic programs with assembly language?
- Know the different types of compilers available to compile c code?
- Practice every predefined syntax in c programming language?
- Implement pre-defined functions in user defined way?
- Perform at least 10 programs on bit wise operators?
- Know the core registers available in c compiler?
- Get the perfection on preprocessor directives and enumeration and
Structures?
- Practice basic circuits in electronics i.e., amplifier, power supply, rectifiers etc.?
- Know basic formulas in electronics?
- Difference between cisc and risc architecture?
- Difference between volatile and nonvolatile memory?
EMBEDDED ACTIVITY LAB 2
- Recall the Introduction of LPC1313 micro controller.
- Practice block diagram of LPC1313 micro controller.
- Know about features of arm cortex m3 processor.
- Practice block diagram of arm cortex m3 processor.
- Know detailed description of NVIC.
- Difference between TRACE and DEBUG.
- Use of WIC block.
- Use of SLEEP and WAKEUP features.
- Find RAM and ROM sizes of LPC1313 controller.
- What are the peripherals are available in LPC1313 controller?
- What are the protocols it can support?
- How many ports are there in LPC1313?
- Each port contains how many pins?
- How many functionalities each pin can have?
- What architecture your LPC1313 follows?
- To which family LPC1313 controller belongs to?
- What is the max size of flash ROM size?
- What core processor is ARM CORTEX M3?
- How many pin IC is LPC1313?
- What is the bus matrix that cortex m3 will fallow?
EMBEDDED ACTIVITY LAB 3
- Installation of KEIL uv4 ide.
- Practice creation of layered architecture in keil uv4.
- Extract the required files from keil folder into respective layers.
- Practice adding and removing of managing project items.
- Know every option in target options.
- Know how to add paths in keil.
- Practice basic programs on keil ide.
- Observe the results on watch windows.
- Know different types of ide’s available in market.
- Difference between simulator and emulators.
- Different types of tool chains?
- Observe the each and every shortcut/option on keil uv4 ide.
- Find twin primes b/w 1-100 in keil.
- Perform reverse of number in keil.
- Find factorials of a number in keil.
- Find Armstrong’s below 1000 in keil.
- Find palindromes below 500 in keil.
- Find perfect numbers b/w 1-1000 in keil.
- Perform set clear and toggle operations on bits in keil.
- Write a function to return the status of a bit in keil.
- Write a function to shift no:of bit to left and right with given size in keil.
- Write a function to swap the bits first to last and visa versa .
EMBEDDED ACTIVITY LAB 4
- Understand the GPIO module working and real time uses?
- Implement the driver for touch key with gpio module?
- Implement the Function to count no:of touches happened on touch pad?
- Implement the function to execute another function after 3 touches happened.
- Implement the driver to configure 5 user keys with gpio module?
- Get the status of each key as user requested?
- Maintain the count of each key with an array?
- Write a program to execute a function when touch and key 4 is simultaneously pressed?
EMBEDDED ACTIVITY LAB 5
- Implement the driver for RGB LED with gpio module.
- Write an generic function to glow RGB led with request color?
- Implement a function to glow all possible colors on RGB LED with 1 second delay?
- Implement the function to Blink led with any one of the possible color?
- Write a function to find the RGB LED current color status?
- What are the possible color combination with RGB led?
EMBEDDED ACTIVITY LAB 6
- Understand the Purpose of ADC?
- Draw block diagram of ADC?
- Explain each block in ADC?
- What are the features of ADC?
- Explain Each feature in detailed way?
- How many types of ADC’s are there and what are there?
- Explain brief about types of ADC’s?
- What id the theoretical formula for ADC to calculate digital output?
- What is SAR and its working?
EMBEDDED ACTIVITY LAB 7
- What is the purpose of DAC in ADC?
- Implement the driver for ADC?
- Write a program to convert analog voltage into digital?
- Write a program to work ADC on Software mode?
- Write a program to work ADC on BURST mode?
- Write a program to collect the ADC readings by using polling technique?
- What are the disadvantages of ADC?
- What is the drawback of dual slope ADC’s?
- What is the advantage of SAR ADC’s?
EMBEDDED ACTIVITY LAB 8
- Write a program to convert digital temperature value in physical value into Celsius?
- Write a program to convert digital temperature value in physical value into Fahrenheit?
- Write a program to find analog joystick position?
- Write a program to collect all converted digital reading into an array?
- Write a program to get the ADC reading by using interrupt technique?
EMBEDDED ACTIVITY LAB 9
- What is the frame format of UART?
- What are advantages and disadvantages of UART?
- What are the possible baud rates of UART?
- What is data packet structure of UART?
- Implement the driver for UART?
- Transmit byte and receive byte in UART serial terminal?
- d/f b/w baud rate and bit rate?
EMBEDDED ACTIVITY LAB 10
- Write a program to transmit string in UART serial terminal?
- Write a program to receive the string from Serial terminal?
- Implement menu driven program with the help of UART serial terminal?
- Implement the function to perform matrix multiplication and print the result on serial terminal.
- Implement the UART driver using Interrupt technique?
- What is use of parity bit in UART?
- Indications for Start and Stop bits in UART?
- Max data transfer in UART is?
EMBEDDED ACTIVITY LAB 11
- What is synchronous and asynchronous communication?
- What are the signals of SPI protocol?
- Implement the driver for SPI as master.
- How the communication will happen in SPI Protocol?
- How the Master and Slave connectivity will be there in SPI?
- What is parallel chain and daisy chain mechanism in SPI?
- What are the slave possibilities are there for SPI?
EMBEDDED ACTIVITY LAB 12
- Implement the driver for MAX7219 SPI Slave.
- Configure SPI as master and MAX7219 as slave.
- Transfer the data from master to slave.
- Initialize the MAX7219 with 2-digit scan mode and min intensity.
- What is the difference between shutdown and normal operation mode in MAX7219 slave?
- Write a program to print 1-1234 numbers with 1 second delay on MAX7219 7 segment display ?