Linux - Study Mode
[#886] Which one of the following in true about this program? #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *ptr
printf("%p
",ptr)
ptr = (char *)malloc(sizeof(char))
printf("%p
",ptr)
return 0
}
Correct Answer
(D) none of the mentioned
[#887] What is the output of this program? #! /usr/bin/awk -f
BEGIN {
a=10
b=10
print a==b ? "true":"false"
}
Correct Answer
(A) true
[#888] What is the output of this program? #include<stdio.h>
#include<stdlib.h>
int main()
{
char *ptr
ptr = (char *)malloc(sizeof(char)*8)
ptr = "example"
printf("%s
",*ptr)
return 0
}
Correct Answer
(B) segmentation fault
[#889] What is the output of this program? #include<stdio.h>
#include<fcntl.h>
int main()
{
int fd, count
fd = open("demo.c",O_RDONLY)
count = write(fd,"Linux",5)
if(count != 5)
perror("write")
return 0
}
Correct Answer
(D) none of the mentioned
[#890] What is the output of this program? #include<stdio.h>
#inlcude<stdlib.h>
int main()
{
int *ptr
double *ptr
printf("%d
",sizeof(ptr))
return 0
}
Correct Answer
(C) the compiler will give the error