Programming Assignment Unit-IV (2024) PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document contains a programming assignment for a unit on programming for problem solving. It includes two and five mark questions covering various programming concepts. Topics include function prototypes, return statements, and different types of variables, such as local, global, and static variables.
Full Transcript
SUBJECT: PROGRAMMING FOR PROBLEM SOLVING ASSIGNMENT-IV UNIT - 4 SUBJECT: Date of issue: ROLLNO: Date of submission: FULL NAME: Total Marks : SECTION:...
SUBJECT: PROGRAMMING FOR PROBLEM SOLVING ASSIGNMENT-IV UNIT - 4 SUBJECT: Date of issue: ROLLNO: Date of submission: FULL NAME: Total Marks : SECTION: ANSWER ALL QUESTIONS 2 MARK QUESTIONS: 1) What is the role of return statement in a function? Can we write a function which can return more than one value using return statement? 2) Write the syntax and example on function prototype declaration. State the difference between formal parameters and actual parameters. 3) Distinguish local variable and global variable 4) What is extern keyword? Why we use it? 5) Define static variable? How it differs from automatic variables? 6) main( ) { int a=15, b=19; int x=sum(a,b); printf(“%d”,x); } int sum(int x, int y) { int c=x+y; return(x); return(y); } 7) main( ) { static int a=1; printf(“%d”,a++); if(a=90 10. Write a program to create a structure for maintaining real and imaginary parts of a complex number. Create a function which accepts two complex numbers and performs addition.