C Programming Test

What will be output if you will compile and execute the following c code?

void main(){

int array[3]={5};

int i;

for(i=0;i<=2;i++)

printf("%d ",array[i]);

}


What will be output if you will compile and execute the following c code?

void main(){

char *str;

scanf("%[^\n]",str);

printf("%s",str);

}


What will be output if you will compile and execute the following c code?

void main(){

int a=5;

float b;

printf("%d",sizeof(++a+b));

printf(" %d",a);

}


What will be output if you will execute following c code?

#include<stdio.h>

int main(){

int x=5, y=10;

if(!(!x) && x)

printf("%d",x);

else

printf("%d",y);

return 0 ;

}


What will be output if you will execute following c code?

#include<stdio.h>

int main(){

float a=0.5, b=0.9;

if(a&&b>0.9)

printf("Sachin");

else

printf("Rahul");

return 0;

}


What will be output if you will execute following c code?

#include<stdio.h>

int main(){

int x=25;

if(!!x)

printf("%d",!x);

else

printf("%d",x);

return 0;

}


What will be output if you will execute following c code?

#include<stdio.h>

int main(){

for(;NULL;)

printf("cquestionbank");

return 0;

}


What will the output of following code?

#include<stdio.h>

int main(){

int a=0;

#if (a==0)

printf("Equal");

#else if

printf("Not equal");

#endif

return 0;

}


Predict the output or error(s) for the following:

void main()

{

int const * p=5;

printf("%d",++(*p));

}


Predict the output or error(s) for the following:

main()

{

char s[ ]="man";

int i;

for(i=0;s[ i ];i++)

printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);

}




























































































Description:

Here are few questions which will test your C Knowledge.
Take the test and reply me.

Discussion

Jhon

Hi, Here is an interesting C program I found on Internet.
http://www.tricksstar.com/2014/10/analog-clock-designed-using-c-programming.html

2226 days 11 hours 49 minutes ago

manishkumarsingh

out put of 10th ques. is not correct

4103 days 18 hours 58 minutes ago

samar

My message for those who are trying for the first time.plz they see the test practice on pc then come back.u will be winner

4228 days 16 hours 36 minutes ago

Pruthwiraj Ghadge
Logic building is the Key to Programmming
User
59 Followers

Your Facebook Friends on WizIQ

More Tests By Author

DBMS and SQL Basics
20 Questions | 5491 Attempts

HTML QUIZ
20 Questions | 19377 Attempts

Basics of C
5 Questions | 252 Attempts