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

C Programming Practice Questions

This document contains 10 questions about C programming code snippets. It asks what the output would be for each snippet, how many main functions can be in a project, and to find possible values of x that would produce a specific output for one snippet.

Uploaded by

Abhay Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

C Programming Practice Questions

This document contains 10 questions about C programming code snippets. It asks what the output would be for each snippet, how many main functions can be in a project, and to find possible values of x that would produce a specific output for one snippet.

Uploaded by

Abhay Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Que-1: What will be the output of the following code snippet?

Int main(){
int i=7;
for(i=5; i !=0 ; i-=2){
printf(“%d”,i);
}
}

Que-2: What will be the output of the following code snippet?


Int main(){
int x = printf(“developers ”);
printf(“%d”,x);
}

Que-3: What will be the output of the following code snippet?


Int main(){
int k;
int x = scanf(“%d”,&k);
printf(“%d”,x);
}

Que-4: What will be the output of the following code snippet?


Int main(){
int b=1,c=2,d=3,e=4;
e=0;
if(b,c,d,e){
printf(“Hello World!”);
}else{
printf(“Hello India!”);
}
}
Que-5: Find all possible values of x,for which output of the following code is “Namaste
India”?
switch(x){
case 13:
case 14:
case 15:
printf(“Hello ”);
break;
case 16:
case 17:
printf(“Hi ! ”);
break;
case 18:
case 19:
printf(“Namaste ”);
default:
printf(“India ”);
}

Que-6: Predict the output of following code


int main(){
int x=6,y=7,z=7;
int res = x+y==z;
printf(“%d”,res);
}

Que-7: Predict the output of following code


int main(){
char str[] = "I am a programmer.";
printf("%s",str+3);
}

Que-8: Predict the output of following code


#include<stdio.h>

main()
{
printf("%d", -1<<1 );
}
Que-9: How many main() function we can have in our project?

Que-10: Predict the output of following code


int main()
{
int x = 10;
{
int x = 0;
printf("%d",x);
}
return 0;
}

You might also like