File Input Output - Study Mode

[#191] If the user enters 1 3.2 s, what value will be returned by the scanf()? scanf("%d %f %c", &s1, &s2, &s3)

Correct Answer

(C) 3

[#192] Why do we write (int *) before malloc? int *ip = (int *)malloc(sizeof(int))

Correct Answer

(B) It is for the type-casting

[#193] What will be the output of the following C code? #include <stdio.h>
int main()
{
FILE *fp

char c

int n = 0

fp = fopen("newfile1.txt", "r")

while (!feof(fp))
{
c = getc(fp)

putc(c, stdout)

}
}
Correct Answer

(D) None of the mentioned

[#194] What will be the output for the given code. printf("
The number is %07d",1212)

Correct Answer

(A) The number is 0001212

[#195] Which of the following snippet will effectively generate random numbers?
Correct Answer

(A) rand()