Tuesday, October 21, 2014

Clear your doubt


1)         What will be output of the following program?
#include<stdio.h>
void main()
{
                        printf("india"-'A'+'B');
}

Output: ndia  


2)         What will be output of the following program?
#include<stdio.h>
void main()
            {
                        printf(4+"good morning");
 }

Output: morning

3)         What will be output of the following program?
#include<stdio.h>
void main()
{
if(sizeof(!6.0))
printf("%d",sizeof(6.0,2));
else
printf("i don't know");
}

Output: 2
 
4)         What will be output of the following program?
                        #include<stdio.h>
void main()
{
                                    printf("Good Morning"+'\10');
}

Output: ning 

5)         What will be output of the following program?
#include<stdio.h>
void main()
{
char a=256;
int b=2;
int c;
c=a+b;
printf("%d",c);
}

Output: 2 

6)         What will be output of the following program?
#include<stdio.h>
void main()
{
float a=3.4;
int b=2;
int c;
c=a+b;
printf("%d",c);
}

Output: 5 

7)         What will be output of the following program?  
                        #include<stdio.h>
void main()
{
                                    int i=66,x=-3;
                                    printf((x>0)?"%d":"%c",i);
}

                        Output: B

8)         Write a scanf statement which can store one line of string which includes white space?
                        #include<stdio.h>
void main()
 {
char a[30];
scanf("%[^\n]",a);
printf("%s",a);
}
9)         Write a c program to print Hello world without using any semicolon.
#include<stdio.h>
void main()
{
                                      if(printf("Hello world")){}
}

10)       What is wild pointer in c?
A pointer in c, which has not been initialized, is known as wild pointer. Ex
#include<stdio.h>
void main()
{
                                     int *p;
                                    printf("%d",*p);
                        }

No comments:

Post a Comment