Cpr - Qb Chapter 05 New

  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Cpr - Qb Chapter 05 New as PDF for free.

More details

  • Words: 558
  • Pages: 2
K. K. Wagh Polytechnic, Nashik – 3.

Question Bank: Programming in ‘C’ (9017) Class: FYIF Chapter No. 05 Pointers Summer 2007: Marks = 28 a) Justify following statements: 2 int a = 10; int *b = &a; int *c = b; int d = *b + *c; b) What is pointer? 2 c) Distinguish between call by value and call by reference (W’07). 4 d) Write a program using pointers to compute sum of all elements stored in an array. 4 e) What will be the output of the following program? 4 #include<stdio.h> void main ( ) { float a = 13.5; float *b, *c; b = &a; c = b /* suppose address of a is 1006*/ printf(“%u %u %f %f”, &a, b, *(&a), *b); } f) Explain use of pointers and arrays. 4 g) Explain the concept of pointer’s arithmetic operations with examples. (W’07) 4 h) How pointer is initialized? 4 Winter 2007: Marks = 28 a) What is pointer variable? 2 b) Give syntax of declaring and initializing pointer. 2 c) Explain concept of array with pointer. 4 d) Write a program to reverse the string using pointer. 4 e) Explain the difference between call by value and call by reference methods for calling function. 4 f) Explain the concept of pointer arithmetic operations. 4 g) What is pointer? Give the use of ampersand (&) and asterisk (*) operators in pointer. 4 h) Explain the meaning of following statement with reference to pointers. 4 int *P, X; X = 10; *P = X; P = &X; Summer 2008: Marks = 28 a) Define call by value. 2 b) What is pointer? Give its declaration. 2 c) Write a simple program for accessing the data through pointer variable. 4 d) Two numbers are input through keyboard into two locations C and D.

CPR – Question Bank Chapter 05 Pointers

-1-

K. K. Wagh Polytechnic, Nashik – 3.

Write a program to interchange the contents of C and D. e) Write a program for exchanging values of two variables using call by reference. f) Explain concept of pointer arithmetic operations. g) Explain how array elements are accessed by using pointers. h) What will be the output of the following program? #include<stdio.h> void main( ) { int i = 3; int * j; j = &i; printf(“\n Address of i = %u”, &i); printf(“\n Address of i = %u”, j); printf(“\n Address of j = %u”, &j); printf(“\n value of j = %u”, j); printf(“\n value of i = %d”, i); printf(“\n value of i = %d”, *(&i)); printf(“\n value of i = %d”, *j); }

4 4 4 4 4

Winter 2008: Marks = 24 a) Give the meaning of declaration int *ptr; 2 b) What is pointer? 2 c) Write a program using pointer to accept an integer array and print it in reverse order. 4 d) Explain the concept array of pointers with example. 4 e) Write a function to swap (exchange) the values of two integer numbers using pointers. 4 f) Explain pointer arithmetic with example. 4 g) Explain the meaning of following statements with reference to pointer: int *ptr, m = 8; *ptr = m; ptr = &m; 4

Mr. Kute T. B. Lecturer in Information Technology, K. K. Wagh Polytechnic, Nashik – 3. [email protected]

CPR – Question Bank Chapter 05 Pointers

-2-

Related Documents