Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

VU Past Papers CS201- Midterm Solved Questions Most Repeated

Q1: What is the correct syntax for declaring a pointer to an integer in C language?
Answer:
A pointer to an integer is declared by specifying the data type int followed by an asterisk * and the pointer’s name. The asterisk indicates that the variable is a pointer.


Q2: How is the memory address of a variable assigned to a pointer in C?
Answer:
The memory address of a variable is assigned to a pointer using the address-of operator &. This makes the pointer store the location in memory where the variable is kept.


Q3: How can a pointer be initialized in C, and what is the significance of NULL in pointer initialization?
Answer:
A pointer can be initialized either by giving it the address of a variable or by assigning it NULL. NULL means the pointer is not pointing to any valid memory location. Initializing with NULL is important to prevent errors when a pointer is used without a proper value.


Q4: In what scenarios is call by reference useful, and how is it simulated using pointers in C functions?
Answer:
Call by reference is useful when a function needs to modify the original value of a variable. In C, this is simulated by passing the memory address of the variable to the function. The function then uses the pointer to access and change the value directly in memory.

Contents Copyrights Reserved By T4Tutorials