Printf & Scanf

11. What is the output of this program?

#include<stdio.h>
int main()
{
int x = 1, y = 2;
printf("%d", x, y);
return 0;
}

A. 1
B. 2
C. Compilation Error
D. Garbage Value

View Answer


12. What is the output of this program?

#include<stdio.h>
int main()
{
int x = 1, y = 2;
printf("%*d", x, y);
return 0;
}

A. 1
B. 2
C. Compilation Error
D. Garbage Value

View Answer


13. What is the output of this program?

#include<stdio.h>
int main()
{
char str[25];
printf(" %d ",printf("c-letsfind"));
return 0;
}

A. 10 c-letsfind
B. 9 c-letsfind
C. c-letsfind 9
D. c-letsfind 10

View Answer


14. What is the output of this program?

#include<stdio.h>
# define loop while(true)
int main()
{
loop;
printf("c-letsfind");
return 0;
}

A. program never ends
B. c-letsfind
C. Compilation error
D. None of the above

View Answer


15. What is the output of this program?

#include<stdio.h>
int main()
{
printf("%d", 5.00);
return 0;
}

A. Compilation error
B. Garbage value
C. 5
D. 0

View Answer


16. What is the output of this program?

#include<stdio.h>
int main()
{
printf("%d",5.25);
return 0;
}

A. Compilation error
B. Garbage value
C. 5
D. 0

View Answer


17. What is the output of this program ?

#include<stdio.h>
int main()
{
int a = 3;
printf("%d");
return 0;
}

A. 3
B. Compilation error
C. Garbage value
D. Runtime error

View Answer


18. What is the output of this program ?

#include<stdio.h>
int main()
{
char *ptr = "Hello World";
printf(ptr+2);
return 0;
}

A. pointer cannot be initialized
B. lo World
C. Runtime error
D. llo World

View Answer


19. What is the output of this program 32 bit c compiler ?

#include<stdio.h>
int main()
{
int a = 1;
printf("%d %p",a,a);
return 0;
}

A. Runtime error
B. 1 00000001
C. 1 1
D. %p is not a format specifier

View Answer


20. What is the output of this program ?

#include<stdio.h>
static struct student
{
int a;
int b;
}
struct_var{2,3};
int main()
{
printf("%d %d",struct_var.a,struct_var.b);
return 0;
}

A. Runtime Error
B. Improper representation of structure variable
C. Compilation error
D. 2 3

View Answer






Also check :


Discussion


* You must be logged in to add comment.