NCIT C program Pre Board Solution

1st sem New Syllabus

12. Program to Print the Reverse Star Pattern

13. Operator Precedence and Associativity

Operator Precedence determines which operator is evaluated first in an expression with multiple operators.
Associativity determines the order when operators have the same precedence (left-to-right or right-to-left).

 

14. Factorial Using Recursion

15. Sum of Array Elements Using Pointer

16. String to Uppercase Without String Functions

17. Program to Filter Students from Pokhara

19. Prefix vs Postfix Increment/Decrement Operators

Difference:

Operator Type Evaluation Example (int x=5, y;) Result
Prefix (++x) Increment then use y = ++x; x=6, y=6
Postfix (x++) Use then increment y = x++; x=6, y=5

20.Array Sorting Program (Ascending Order)

22. Passing Arguments by Value vs by Address

Comparison Table

Feature Pass by Value Pass by Address (Pointer)
Mechanism Copies the actual value Passes memory address of the value
Memory Usage Creates duplicate No duplication
Original Value Cannot be modified Can be modified
Performance Slower for large data Faster for large data
Syntax Normal parameter Pointer parameter
Safety More secure (no side effects) Less secure (can modify original)

Example Programs

Pass by Value:

Pass by Address:

 

Leave a Reply

Your email address will not be published. Required fields are marked *