Header Ads Widget

Programs based on pointer and file handling.

 Here are question based on pointers and file handling .. And after solving these questions your all the doubts will be clear related to this topic. So these questions carefully.

Here are some sample questions for downloading full pdf of the questions click on the link.

C Programs based on pointers:-

1.Write a program to print the address of a variable whose value is input from user.

2.Write a program to print the address of the pointer to a variable whose value is input from user.

3.Write a program to print the value of the address of the pointer to a variable whose value is input from user.

4.Write a program to print a number which is entered from keyboard using pointer.

5.Write a function which will take pointer and display the number on screen. Take number from user and print it on screen using that function.

C Programs based on File Handling:-

1. Write a program in C to create and store information in a text file

2. Write a program in C to read an existing file

3. Write a program in C to write multiple lines in a text file.

4. Write a program in C to read the file and store the lines into an array

 5. Write a program in C to Find the Number of Lines in a Text File

MCQs based on pointers:-

1. "&" is called as ___________ in pointer concept.

a.Conditional Operator

b.Logical Operator

c.Address Operator

d.None of these



2. "*" is called as ___________.

a.Address Operator

b.Value at Operator

c.Scope Resolution Operator

d.None of these


3.What is the output of the program ?

#include<stdio.h>

int main()

{

    int a[5] = {2, 3};

    printf("%d, %d, %d\n", a[2], a[3], a[4]);

    return 0;

}

a.Garbage Values

b.2, 3, 3

c.3, 2, 2

d.0, 0, 0


4.What is (void*)0?

a.Representation of NULL pointer

b.Representation of void pointer

c.Error

d.None of above


5.Can you combine the following two statements into one?

char *p;

p = (char*) malloc(100);

a.char p = *malloc(100);

b.char *p = (char) malloc(100);

c.char *p = (char*)malloc(100);

d.char *p = (char *)(malloc*)(100);

Download Practice question pdf :-

Click on the given links for the questions:-

1)Practice questions based on decision control

2) Practice questions based on loops and functions

3) Practice questions based on array and string and searching , sorting 

4) Practice questions based on pointer and file handling



Recommended Post:

Hackerearth Problems:-

Hackerrank Problems:-
Data structure:-

Key points:-

 MCQs:-