File Input Output - Study Mode
[#196] What will be the output of the following C code? #include <stdio.h>
#include <stdarg.h>
int f(...)
int main()
{
char c = 97
f(c)
return 0
}
int f(...)
{
va_list li
char c = va_arg(li, char)
printf("%c
", c)
}
Correct Answer
(A) Compile time error
[#197] What will be the output of the following C code? #include <stdio.h>
int main()
{
char *str = "hello, world"
char str1[15] = "hello wo 9"
strcpy(str, str1)
printf("%s", str1)
}
Correct Answer
(B) Segmentation Fault
[#198] What does the C statement given below says? scanf("%7s",ch)
Correct Answer
(B) read string with maximum 7 characters
[#199] Which is the correct way to generate numbers between minimum and maximum(inclusive)?
Correct Answer
(B) minimum + (rand() % (maximum - minimum + 1))
[#200] What will be the output of the following C code? #include <stdio.h>
int main()
{
char str[10] = "hello"
char *str1 = "world"
strncat(str, str1, 9)
printf("%s", str)
}
Correct Answer
(A) helloworld