0% found this document useful (0 votes)
40 views

Void Printf ("%s","cquestionbank") : Struct Int Int Int Void Struct

The document contains 20 coding questions related to C programming. Some questions involve basic concepts like data types, operators, functions, structures and pointers. Other questions test more advanced concepts like unions, typecasting, function pointers, string handling and arrays. The coding questions would help assess a candidate's understanding of core C programming concepts as well as their ability to apply logic and problem solving skills to code solutions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Void Printf ("%s","cquestionbank") : Struct Int Int Int Void Struct

The document contains 20 coding questions related to C programming. Some questions involve basic concepts like data types, operators, functions, structures and pointers. Other questions test more advanced concepts like unions, typecasting, function pointers, string handling and arrays. The coding questions would help assess a candidate's understanding of core C programming concepts as well as their ability to apply logic and problem solving skills to code solutions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Placement test 20

C
1.

struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf("%d %d %d",s.p,s.c,s.m);
}
2.

void main(){
printf(%s,cquestionbank);
printf("%s","c" "question" "bank");
printf(%s,__DATE__);

}
3.

void main(){
char *str="c-pointer";
printf("%*.*s",10,7,str);
}

4.

void start();
void end();
#pragma startup start
#pragma exit end
int static i;
void main(){
printf("\nmain function: %d",++i);
}
void start(){
clrscr();
printf("\nstart function: %d",++i);
}
void end(){
printf("\nend function: %d",++i);
getch();}

5.

void main(){
int a=-12;
a=a>>3;
printf("%d",a);
printf("%d
%d",sizeof("string"),strlen("string"));
getch();
}

6.

void main(){
static main;
int x;
x=call(main);
clrscr();
printf("%d ",x);
getch();
}
int call(int address){
address++;
return address;

}
void main(){
int a,b;
a=1,3,15;
b=(2,4,6);
clrscr();
printf("%d ",a+b);
getch();

7.

}
8.

void main(){
int i=0;
if(i==0){
i=(5,(i=3),i=1);
printf("%d",i);
}

else
printf("equal");
}
9.

#define message "union is\


power of c"
void main(){
clrscr();
printf("%s",message);
getch();
}

10.

void main()
{
struct field
{
int a;
char b;
}bit;
struct field bit1={5,'A'};
char *p=&bit1;
*p=45;
clrscr();
printf("\n%d",bit1.a);
getch();
}
Complete the printf statement to get output as 1 A i 1.800000
11. void main()

{
struct world
{
int a;
char b;
struct india
{
char c;
float d;
}p;
};
struct world st ={1,'A','i',1.8};
clrscr();

printf("%d\t%c\t%c\t%f",xxxxxxx);
getch();
}
12. complete the statement marked with ** to get output as 2 p q 1.400000

void main()
{
struct india
{
char c;
float d;
};
struct world
{
int a[3];
char b;
struct india orissa;
};
**struct world st ={xxxxxxx};
clrscr();
printf("%d\t%c\t%c\t%f",st.a[1],st.b,st.orissa.c,
st.orissa.d);
getch();
}
13.

int main(){
int a = 320;
char *ptr;
ptr =( char *)&a;
printf("%d ",*ptr);
return 0;
}
14. int

main(){
void (*p)();
int (*q)();
int (*r)();
p = clrscr;
q = getch;
r = puts;
(*p)();
(*r)("cquestionbank.blogspot.com");
(*q)();
return 0;
}

15.
int main(){
int i = 3;
int *j;
int **k;
j=&i;
k=&j;
printf("%u %u %d ",k,*k,**k);
return 0;

address of i=xx
address of j=yy
address of k=zz

}
16. #include<stdio.h>

#include<string.h>
int main(){
char *ptr1 = NULL;
char *ptr2 = 0;
strcpy(ptr1," c");
strcpy(ptr2,"questions");
printf("\n%s %s",ptr1,ptr2);
return 0;

}
17. #include<stdio.h>

#include<string.h>
int main(){
int register a;
scanf("%d",&a);
printf("%d",a);
return 0;
}
18. #include<stdio.h>

int main(){
int * p , b;
b = sizeof(p);
printf("%d" , b);
return 0;
}
19. #include<stdio.h>

int main(){
int i = 5 , j;
int *p , *q;

// input :25

p = &i;
q = &j;
j = 5;
printf("%d %d",*p,*q);
return 0;
}
20. #include<stdio.h>

int main(){
int i = 5;
int *p;
p = &i;
printf(" %u %u", *&p , &*p);
return 0;
}
write the c programs for the following:
1. Write a program to display all the ASCII values
2. Display the first upper case charcter in a string
3. Display the range of all data types ( int float char ) signed and
unsigned .
4. Swap two numbers using bitwise operators
5. Search an element in array and delete it ( its position should be
occupied by the next element in array)

You might also like