PLDC Question BAnk MCQ II 2023-24

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Priyadarshini Bhagwati College of Engineering ,Nagpur

Question Bank(UNIT: 3,4,&5)

Subject: Programming Logic & Design using C

_________________________________________________________________________________

What is a structure in C language?

a) A structure is a collection of elements that can be of same datatype


b) A structure is a collection of elements that can be of different datatype
c) Elements of a structure are called members
d) All of the these

What is the size of a C structure?

a) C structure is always 128 bytes


b) Size of C structure is the totatl bytes of all elements of structure
c) Size of C structure is the size of largest elements
d) None of the above

Choose a correct statement about C structure elements?

a) Structure elements are stored on random free memory locations


b) structure elements are stored in register memory locations
c) structure elements are stored in contiguous memory locations
d) None of the above

What is actually passed if you pass a structure variable to a function?

a) Copy of structure variable


b) Reference of structure variable
c) Starting address of structure variable
d) Ending address of structure variable

Which of the following cannot be a structure member?

a) Another structure
b) Function
c) Array
d) None of the mentioned
Most appropriate sentence to describe unions is

A. Union are like structures

Union contain members of different data types which share the same storage
B.
area in memory

C. Union are less frequently used in program

D. Union are used for set operations

Members of a union are accessed as________________.

A. union-name.member
B. union-pointer->member
C. Both a & b
D. None of the mentioned

Which of the following true about FILE *fp

a) FILE is a keyword in C for representing files and fp is a variable of FILE type


b) FILE is a stream
c) FILE is a buffered stream
d) FILE is a structure and fp is a pointer to the structure of FILE type

Which is data type of file pointer is _______

a) int
b) double
c) void
d) File

The first and second arguments of fopen() are

a) A character string containing the name of the file & the second argument is the mode
b) A character string containing the name of the user & the second argument is the mode
c) A character string containing file pointer & the second argument is the mode
d) None of the mentioned

A data of the file is stored in _______

a) Ram
b) Hard disk
c) Rom
d) None

fseek() should be preferred over rewind() mainly because

a) rewind() doesn't work for empty files


b) rewind() may fail for large files
c) In rewind, there is no way to check if the operations completed successfully
d) All of the above

A mode which is used to open an existing file for both reading and writing ______

a) ”W”
b) ”W+”
c) ”R+”
d) ”A+”

Select a function which is used to write a string to a file ______

a) pits()
b) putc()
c) fputs()
d) fgets()

Select a function which is used as a formatted output file function ______

a) printf()
b) fprintf()
c) puts()
d) fputs()

What is the return value of putchar()?

a) The character written


b) EOF if an error occurs
c) Nothing
d) Both character written & EOF if an error occurs

What is the return type of malloc() or calloc()?

A. int *
B. int **
C. void *
D. void **

Which function is used to delete the allocated memory space?

A. Dealloc()
B. free()
C. Both A and B
D. None of the above

Among 4 header files, which should be included to use the memory allocation functions like
malloc(), calloc(), realloc() and free()?

A. #include<string.h>
B. #include<stdlib.h>
C. #include<memory.h>
D. Both b and c

Why to use fflush() library function?

A. To flush all streams and specified streams


B. To flush only specified stream
C. To flush input/output buffer
D. Invalid library function

What if functionality if realloc() function?

(a) Change the location of memory allocated by malloc() or calloc().

(b) Reallocates memory deleted by free() function.

(c) It is used to modify the size of the previously allocated memory space.

(d) None of these

What is the return value of malloc() if it fails to allocate

i) NULL ii)-1 iii)0 iv)1

You might also like