wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PPS - Chapter 7,8,9,10

Total questions: 60

Worksheet time: 3hrs 0mins

Name
Class
Date
1.

Comment on the following pointer declaration. int *ptr, p;

a)

ptr is a pointer to integer, p is not

b)

ptr and p, both are pointers to integer

c)

ptr is a pointer to integer, p may or may not be

d)

ptr and p both are not pointers to integer

2.

Comment on the following C statement. const int *ptr;

a)

You cannot change the value pointed by ptr

b)

You cannot change the pointer ptr itself

c)

You May or may not change the value pointed by ptr

d)

You can change the pointer as well as the value pointed by it

3.
Which is an indirection operator among the following?
a)
&
b)
*
c)
->
d)
.
4.
Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0;)?
a)
int *ptr = &a;
b)
int *ptr = &a – &a;
c)
int *ptr = a – a;
d)
All of the mentioned
5.
Which of the following is the correct syntax to send an array as a parameter to function?
a)
func(&array);
b)
func(#array);
c)
func(*array);
d)
func(array[size]);
6.
Which of the following can never be sent by call-by-value?
a)
Variable
b)
Array
c)
Structures
d)
Both Array and Structures
7.
Which of following logical operation can be applied to pointers?
a)
a | b
b)
a ^ b
c)
a & b
d)
None of the mentioned
8.
How many number of pointer (*) does C have against a pointer variable declaration?
a)
7
b)
127
c)
255
d)
No Limit
9.
Which of the following declaration will result in run-time error?
a)
int **c = &c;
b)
int **c = &*c;
c)
int **c = **c;
d)
none of the mentioned
10.
What is the correct syntax to send a 3-dimensional array as a parameter?
a)
func(a);
b)
func(&a);
c)
func(*a);
d)
func(**a);
11.

An array of strings can be initialized by _________

a)

char *a[] = {“Hello”, “World”};

b)

char *a[] = {“Hello”, “Worlds”};

c)

char *b = "Hello"; char *c = "World"; char *a[] = {b, c};

d)

all of the mentioned

12.
Which of the following declaration are illegal?
a)
int a[][] = {{1, 2, 3}, {2, 3, 4, 5}};
b)
int *a[] = {{1, 2, 3}, {2, 3, 4, 5}};
c)
int a[4][4] = {{1, 2, 3}, {2, 3, 4, 5}};
d)
none of the mentioned
13.
How to call a function without using the function name to send parameters?
a)
typedefs
b)
Function pointer
c)
Both typedefs and Function pointer
d)
None of the mentioned
14.
Which of the following is a correct syntax to pass a Function Pointer as an argument?
a)
void pass(int (*fptr)(int, float, char)){}
b)
void pass(*fptr(int, float, char)){}
c)
void pass(int (*fptr)){}
d)
void pass(*fptr){}
15.
One of the uses for function pointers in C is __________
a)
Nothing
b)
There are no function pointers in c
c)
To invoke a function
d)
To call a function defined at run-time
16.
Local variables are stored in an area called ___________
a)
Heap
b)
Permanent storage area
c)
Free Memory
d)
Stack
17.
The size of both stack and heap remains the same during run time
a)
true
b)
false
18.
Choose the statement which is incorrect with respect to dynamic memory allocation.
a)
Memory is allocated in a less structured area of memory, known as heap
b)
Used for unpredictable memory requirements
c)
Execution of the program is faster than that of static memory allocation
d)
Allocated memory can be changed during the run time of the program based on the requirement of the program
19.
Which of the following header files must necessarily be included to use dynamic memory allocation functions?
a)
stdlib.h
b)
stdio.h
c)
memory.h
d)
dos.h
20.
The type of linked list in which the node does not contain any pointer or reference to the previous node is _____________
a)
Circularly singly linked list
b)
Singly linked list
c)
Circular doubly linked list
d)
Doubly linked list
21.
Which of the following is an example of static memory allocation?
a)
Linked list
b)
Stack
c)
Queue
d)
Array
22.
Array is preferred over linked list for the implementation of ________
a)
Radix sort
b)
Insertion sort
c)
Binary search
d)
Polynomial evaluation
23.
The advantage of using linked lists over arrays is that ________
a)
Linked list is an example of linear data structure
b)
Insertion and deletion of an element can be done at any position in a linked list
c)
Linked list can be used to store a collection of homogenous and heterogeneous data types
d)
The size of a linked list is fixed
24.

What will be the output of the C code if the input entered as first and second number is 5 and 6 respectively?

a)

56

b)

Address of the locations where the two numbers are stored

c)

57

d)

Error

25.
In the function malloc(), each byte of allocated space is initialized to zero.
a)
true
b)
false
26.

Which of the following functions allocates multiple blocks of memory, each block of the same size?

a)

malloc()

b)

realloc()

c)

calloc()

d)

free(0)

27.
A condition where in memory is reserved dynamically but not accessible to any of the programs is called _____________
a)
Memory leak
b)
Dangling pointer
c)
Frozen memory
d)
Pointer leak
28.
The incorrect statement with respect to dangling pointers is __________
a)
Pointer pointing to non-existent memory location is called dangling pointer
b)
When a dynamically allocated pointer references the original memory after it has been freed, a dangling pointer arises
c)
If memory leak occurs, it is mandatory that a dangling pointer arises
d)
Dangling pointer may result in segmentation faults and potential security risks
29.
a)

error

b)

welcome

c)

memory location stored by the pointer

d)

junk value

30.
In the function realloc(), if the new size of the memory block is larger than the old size, then the added memory __________
a)
is initialized to junk values
b)
is initialized to zero
c)
results in an error
d)
is not initialized
31.
Which of the following are themselves a collection of different data types?
a)
string
b)
structures
c)
char
d)
all of the mentioned
32.
User-defined data type can be derived by___________
a)
struct
b)
enum
c)
typedef
d)
all of the mentioned
33.
Which operator connects the structure name to its member name?
a)
b)
<-
c)
.
d)
Both <- and .
34.
Which of the following cannot be a structure member?
a)
Another structure
b)
Function
c)
Array
d)
None of the mentioned
35.
Which of the following structure declaration will throw an error?
a)
struct temp{}s; main(){}
b)
struct temp{}; struct temp s; main(){}
c)
struct temp s; struct temp{}; main(){}
d)
None of the mentioned
36.
a)

2

b)

4

c)

1

d)

7

37.

Which of the following statements correct about the below code? maruti.engine.bolts=25;

a)

Structure bolts is nested within structure engine.

b)

Structure engine is nested within structure maruti.

c)

Structure maruti is nested within structure engine.

d)

Structure maruti is nested within structure bolts.

38.
a)

Compile time error

b)

sizeof(int) + sizeof(char)

c)

Depends on the compiler

d)

sizeof(int)

39.
When a structure is declared as the member of another structure is called as ………….
a)
Nested structure
b)
Rooted structure
c)
Multiple structure
d)
Parent Structure
40.
In Union, each member will have …………….. memory space
a)
Eual
b)
Different
c)
own
d)
Partial
41.
Presence of code like “s.t.b = 10” indicates __________
a)
Syntax Error
b)
Structure
c)
double data type
d)
An ordinary variable name
42.
In a nested structure definition, with country.state.district statement, memeber state is actually present in the structure.? (COUNTY, STATE, DISTRICT structures)
a)
district
b)
state
c)
country
d)
None of the above
43.
Choose a correct statement about C structures.
a)
A structure enables display of folder structure in OS.
b)
A structure enables erasing contents in a folder in OS.
c)
A structure enables to detect and respond to mouse clicks.
d)
All the above
44.
Choose a correct statement about structure and array.?
a)
An array stores only elements of same type. Accessing elements is easy.
b)
A structure is preferred when different type elements are to be combined as a single entity.
c)
An array implementation has performance improvements to structure
d)
All the above
45.
What are the types of data allowed inside a structure.?
a)
int, float, double, long double
b)
char, enum, union
c)
pointers and Same structure type members
d)
All the above
46.
A file is collection of …………….. stored on secondary storage device.
a)
Characters
b)
symbols
c)
numbers
d)
bytes
47.
In fopen(), the second parameter will indicate ……………
a)
File Name
b)
File address
c)
File Mode
d)
File Size
48.
When any file is open the current position of offset is always at ……………
a)
Given Position
b)
EOF (End Of File)
c)
BOF (Beginning Of File)
d)
End
49.
………….. function returns the current offset position.
a)
fseek()
b)
ftell()
c)
EOF
d)
rewind()
50.
…………. Funtion puts the file pointer to the first position.
a)
Fseek()
b)
ftell()
c)
EOF()
d)
rewind()
51.
……………….. function checks whether the end of file is reached or not.
a)
feof()
b)
EOF()
c)
fseek()
d)
ftell()
52.
File pointer are defined by …………….. keyword.
a)
File
b)
pointer
c)
FILE
d)
None
53.
………………….. function is used to get a single character from file at a time.
a)
Fgets()
b)
fscanf()
c)
fgetc()
d)
fgetchar()
54.
How many modes are available for opening a file?
a)
2
b)
3
c)
4
d)
6
55.
 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
56.
Which of the following mode argument is used to truncate?
a)
a
b)
w
c)
f
d)
t
57.
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
58.
FILE is of type ______
a)
int type
b)
char * type
c)
struct type
d)
None of the mentioned
59.
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
60.
For binary files, a ___ must be appended to the mode string.
a)
"b"
b)
"B"
c)
"binary"
d)
"01"