STRUCTURES AND FILE MANAGEMENT IN C
STRUCTURES AND FILE MANAGEMENT IN C
1.
Which of the following is true for definition of a structure
A) Items of the same data type B) Items of the different data type
C)Integers with user defined names D)
List of Strings
2.
The keyword used to define a structure is
A)
stru B) struct C) structure D) STRUC
3.
The operator used to access the structure member is
A) * B) & C) . D) |
4.
The operator exclusively used with
pointer to structure is A) . B) [ ] C) Ã D) *
5.
Which of the following is correct for a Structure definition?
A)
Scalar data
type B) Derived data type C) Enumerated type D) Null Type
6.
When accessing a structure member, the identifier to
the left of the dot operator is
A)
A structure member B)
The structure tag
C) A structure variable D) The keyword struct
7.
When a structure is an element to another structure, it is called as a
A) Union B) Structure within a structure
C) Pointer to Structure D)
Array of Structures
8.
A structure
is one which contains a pointer to its own type.
A)
Self-referential B) Nested C) Array D) Pointer
9.
Consider the following declaration
of Union union st
{
char c; int x; float y;
}p;
How many bytes
are allocated to union variable p?
A)
7 bytes B) 4 bytes C) 1 byte D) 2 bytes
10.
In C language the Bit fields are used to
A) Save time B)
Save
memory
C) Change order of allocation of memory D)
Save Program
11. The size of
structure and union is same when they contain
A)
Single member B) any number of members
C) Arrays of different types D)
Pointers to different types
12.
The operator used to find the size of any variable
A) sizeof() B) sizof() C)
size of() D) size()
13.
A)
* and . B) &and . C) * and & D)
& and |
14.
Union can store number
of values at a time
A)
All its members B) Only 1 C)
2 D) Cannot
hold value
15.
‘C‘ provides a facility for user defined data type using
concept
A) Array B) Function C)
Pointer D) Structure
16. In the expression
pà value, p is a
A)
Address B) Pointer C) Structure D)
Header
17.
In C language the expression(*ps).x is equal to
A) ps->x B) x->ps C) ps->*x D) None
18. Which of the
following is a list of named integer constants?
A)
typedef B)enumeration C)structure D) union
19. Which
of the following is a memory location that is shared by two or more different
types of variables?
A) typedef B)enumeration C)structure D) union
20.
argv[0] points to
A)
Program name B) First
argument C) Both D) None
21.
Which of the following is true about a File in C?
A) It is a data type B) A region of storage in Disk
C) A variable D) Pointer
22. If the function fopen() fails, it returns
A)
-1 B) 1 C) NULL D) Address
23. The function used
for writing a character to a file is _
A)
putc() B) fputs() C) fputchar() D) putw()
24. The function used
for reading a formatted
input data from a file is
A)
getchar() B) fscanf() C) fgetc() D)fgets()
25.
function set the pointer position
anywhere in the data file
A)
fseek() B) feof() C) ftell() D) rewind()
26. The mode used for
opening an existing file for reading a binary stream is
A)
r B) rb C) wb D) w
27. The mode used for
opening an existing file for reading & writing a text stream is
A. r+ B) r C)
w+ D) w
28.
In C, file processing function fseek() _
A)
needs 2 arguments B)makes
rewind function unnecessary
C)takes 3 arguments D)none of the above
29.
rewind() function takes __ number of arguments.
A) 1 B) 2 C) 3 D) 0
30.
fseek(fptr,0,0) is equivalent to
A)
ftell B) rewind C)a
& b D) none of the above
31.
Which among the following is odd one out?
A) printf B) fprintf C) putchar D) scanf
32. The value of EOF is
_
A) -1 B) 0 C)
1 D) 10
33. Which of the
following fopen statements are illegal?
A)
fp = fopen(―abc.txt‖, ―r‖);
B)
fp = fopen(―/home/user1/abc.txt‖, ―w‖);
C)
fp = fopen(―abc‖, ―w‖);
D)
None of the mentioned
34. What
does the following segment of code do fprintf(fp,
―Copying!‖);
A)
It writes “Copying!” into the
file pointed by fp
B)
It reads ―Copying!‖ from the file and prints on display
C)
It writes as well as reads
―Copying!‖ to and from the file and prints it
D)
None of the mentioned
35.
FILE reserved word
is
A)
A structure tag declared in stdio.h B)
One of the basic datatypes in c
C) Pointer to the
structure defined in stdio.h
D) It is a type name defined in stdio.h
36.
Which of the following causes an error
A)
Trying to read a file that doesn‘t exist
B)
Inability to write data in a file.
C)
Failure to allocate memory with the help of malloc
D)
All of the menioned
37. fputs adds
newline character
A) true B) false
C) Depends on the standard D) Undefined behavior
38.
In fseek() function , the position value 2 indicates
A)
Beginning of
file B) End of file C) Current position D) All
39. Which of the
following are C preprocessors?
A) #ifdef B) #define C) #endif D) All
40.
In fseek() function , the position value 1 indicates
A)
Beginning of
file B) End of file C) Current position D) All
Related Posts
Subscribe Our Newsletter
0 Comments to " STRUCTURES AND FILE MANAGEMENT IN C"
Post a Comment
Share your view here!!