Answer:
Legal statements:
SUV s = new SUV();
Car c = new SUV();
Vehicle v = new SUV();
Vehicle v1 = new Car();
illegal statements:
SUV s1 = new Car();
Car c1 = new Vehicle();
Explanation:
The options a, b, c, d are correct and legal statements because the syntax is correct, they follow the inheritance principles and therefore can be used for type cast.
The options e, f are incorrect and illegal statements because they do not follow the inheritance principles and therefore can not be used for type cast.
They are both right but i would say that B seems to have the best explanation and the best reasons for what you should do. Hope this helps:)
It would often connect via a universal serial bus (USB) cable, so answer [B].
Answer:
getc() or feof() in c/c++.
Explanation:
getc() returns EOF(End of File) when the end of the file reached is reached but it is not efficient because it also return EOF when it fails.
feof() returns non-zero value when the EOF is reached otherwise it return 0.So feof() is an efficient method to read a file.
For example:-
#include <stdio.h>
int main()
{
FILE *f = fopen("sample.txt", "r");
int c = getc(f);
while (c!= EOF)
{
putchar(ch);
ch = getc(f);
}
if (feof(f))
printf("\n File has ended.");
else
printf("\n Reading not happened.");
fclose(f);
getchar();
return 0;
}