0% found this document useful (0 votes)
101 views6 pages

Pic 22413 MCQ Unit 6

This document provides a question bank with multiple choice questions and answers about pointers for the subject Programming in C. It includes 13 multiple choice questions about pointers, covering topics like what a pointer is, reasons for using pointers, how to write pointer expressions, pointer variable declaration and initialization, passing pointers to functions, and pointer operations. The questions have a single correct multiple choice answer listed along with an explanation.

Uploaded by

DESTROYER
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views6 pages

Pic 22413 MCQ Unit 6

This document provides a question bank with multiple choice questions and answers about pointers for the subject Programming in C. It includes 13 multiple choice questions about pointers, covering topics like what a pointer is, reasons for using pointers, how to write pointer expressions, pointer variable declaration and initialization, passing pointers to functions, and pointer operations. The questions have a single correct multiple choice answer listed along with an explanation.

Uploaded by

DESTROYER
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Department of Computer Engineering

Academic Year 2020-21

Class: Computer & IT


Subject: 22226 PCI (Programming in C) MCQ

Unit 6: Pointers
MCQ Question Bank with Answers

2nd SEM ALL SUBJECT MCQ: click here

1. A pointer is

A. A variable that stores address of an instruction

B. A variable that stores address of other variable

C. A keyword used to create variables

D. None of these

Ans : B

2. The reason for using pointers in a C program is


A. Pointers allow different functions to share and modify their local variables.

B. To pass large structures so that complete copy of the structure can be avoided.

C. Pointers enable complex “linked" data structures like linked lists and binary trees.

D. All of the above

Ans : D

3. How can you write a[i][j][k][l] in equivalent pointer expression?

A. (((***(a+i)+j)+k)+l)

B. ((**(*(a+i)+j)+k)+l)

C. (*(*(*(a+i)+j)+k)+l)

D. *(*(*(*(a+i)+j)+k)+l)

Ans : D

4. What is the base data type of a pointer variable by which the memory would be allocated

to it?

a) int

b) float

c) No datatype

d) Depends upon the type of the variable to which it is pointing


e) unsigned int

Ans: e

5. Prior to using a pointer variable it should be

a) Declared

b) Initialized

c) Both declared and initialized

d) None of these

Answer: C

6. In C a pointer variable to an integer can be created by the declaration

a) int p*;

b) int *p;

c) int +p;

d) int $p;

Answer: B

7. A pointer variable can be

a) Passed to a function

b) Changed within a function

c) Returned by a function
d) Can be assigned an integer value

Answer: C

8. What will be the output of the following C code?

void main() {

int a[] = {1,2,3,4,5}, *p;

p = a;

++*p;

printf("%d ", *p);

p += 2;

printf("%d ", *p);

a) 24

b) 34

c) 22

d) 23

Answer: D

9. What is the output of the following C code?

char *ptr;

char mystring[] = "abcdefg";

ptr = myString;

ptr += 5;
a) fg

b) efg

c) defg

d) cdefg

e) bcdefg

Answer: A

10. Will this program compile?

int main() {

char str[5] = "LetsFind";

return 0;

a) True

b) False

Answer: A

11. Is the NULL pointer the same as an uninitialised pointer?

a) True

b) False

Answer: B

12. Which of the following statements is correct about k used in the below statement?

char ****k;
a) k is a pointer to a pointer to a pointer to a char

b) k is a pointer to a pointer to a pointer to a pointer to a char

c) k is a pointer to a char pointer

d) k is a pointer to a pointer to a char

Answer: B

13. What will be the output of the program?

char *p = 0;

char *t = NULL;

a) Yes

b) No

Answer: B

Happy Learning!

cwipedia.in

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy