Docsity

Variables, Operators, Arrays, Pointers-Computer Fundamentals-Quiz, Exercises of Computer Fundamentals

Toggle sidebar
bg1
Computing Fundamentals
Quiz Marks[2.5*4]
Write short answers of the following questions.
1- What is the difference between a variable and a reference to a variable?
2- Write two examples to show the two different uses of & operator, also write the
name of the operator for each example.
3- Is it possible to traverse an array by using pointer to that array if so write an
example
4- What is meant by pointer to pointer, draw diagram to differentiate between a
pointer and a pointer to pointer
Docsity.com
pf2

Partial preview of the text

Download Variables, Operators, Arrays, Pointers-Computer Fundamentals-Quiz and more Exercises Computer Fundamentals in PDF only on Docsity!

Computing Fundamentals

Quiz Marks[2.5*4]

Write short answers of the following questions.

1- What is the difference between a variable and a reference to a variable?

2- Write two examples to show the two different uses of & operator, also write the

name of the operator for each example.

3- Is it possible to traverse an array by using pointer to that array if so write an

example

4- What is meant by pointer to pointer, draw diagram to differentiate between a

pointer and a pointer to pointer

Docsity.com

CF-Quiz Marks [10]

Q1-Write output of the following programs

Program-A main( ){ int A[5]={1,2,3,4,5},num=15,dum=10,result; int ptr; ptr=A; result=(++ptr)+num--+dum--; ptr++; dum=++ptr+(++num)+(++dum); cout<<result<<" "<<ptr<<" "<<dum; } Program-B main(){ int a[10]={1,2,3,4,5,6,7,8,9,10},ptr; for(int d=0;d<5;d++){ ptr=(&a[d]+2); cout<<ptr; ptr++; } } Program-C main(){ int *doubl,single,size; doubl=&single; doubl=&size; doubl=10; cout<<size<<single<<doubl; } Docsity.com