Software Eng
Software Eng
MINOR WORK
Even Semester: May-Oct-2023
Course Teacher: Dr. U.P. Kulkarni
2023
Submitted By
MS. VAISHNAVI KULKARNI
2SD21CS114
th
4 Semester B division
Page 1 of 14
[Document title]
TABLE OF CONTENTS
TERMWORK 1- Write a C program to show that C programming Language
support only Call by Value.
Problem Statement 3
Program 3
Sample Input and output 4
TERMWORK-2: Study the concept “USABILITY”. Prepare a report on
USABILITY of at least TWO UIs of major software product you have
seen.
Problem Statement 5
Example 1 5
Sample Input and output 6
Example 2 8
Sample Input and output 9
TERMWORK-3 List all features of a programming language and write
programs to show they help to write a robust code.
Problem Statement 10
Theory 10
TERMWORK-4 Study the ASSERTIONS in C and its importance in
writing reliable code. Prepare an appropriate business scenario and
implement the same.
Problem Statement 12
Business scenario 12
TERMWORK-5 Study the POSIX standard system calls and write a
program to demonstrate it.
Problem Statement 13
Program 14
Page 2 of 14
[Document title]
There are two parameter passing methods passing (or calling) methods to functions.
They are Call by Value and Call by Reference. The most significant distinction
between call by value and call by reference is that in the call by value, passing an
actual value of the parameter. While, in a call by reference, passing the reference of
the parameter; hence some change made to formal arguments will also reflect in
actual arguments. C Language only supports Call by Value.This means that the
called function is given the values of its arguments in temporary variables rather than
the originals. This leads to some different properties than are seen with “call by
reference”. In C, both the calling and called functions don’t share any memory they
have their copy, along with the called function can’t directly change a variable in the
calling function; it may only alter its private, temporary copy. Call by value is an
asset, however, not a liability. It usually leads to more compact programs with fewer
extraneous variables, because parameters can be treated as conveniently initialized
local variables in the called routine.
#include <stdio.h>
void Value(int num)
{
num = 7;
printf("Value of number: %d\n", num);
}
int main()
{
int num = 5;
printf("Before value: %d\n", num);
Value(num);
printf("After value: %d\n", num);
return 0;
}
Page 3 of 14
[Document title]
This demonstrates that changes made to the parameter inside the function do not
affect the original argument in the caller function. When a variable is passed as an
argument to a function in C, a copy of its value is created and passed to the function.
Therefore, any modifications made to the parameter inside the function are only
applied to the local copy, and the original value of the argument remains unaffected.
This behavior is known as "Call by Value" in C.
Here the value of num in the main function is declared as 5. A function Value is
called. In that function the value of the num is initialized to 7. After the execution of
the function is finished the control is given back to the main function. In the main
function if we print the value of num, its value will the same as it was in the main
function. The changes made in the function will not effect the value in the main
function. Only the copy of the variable is sent to the function not the actual variable.
Page 4 of 14
[Document title]
Usability is a way to measure how easy a product is to use. It is a concept in design circles to
ensure products—whether websites, mobile applications can be used as simply and
painlessly as possible. Good usability means users can accomplish their tasks quickly, with
minimal stress and errors, and ultimately feel satisfied in their interaction with a product.
For websites in particular, usability is crucial. Visitors to a website can easily leave as soon as
they encounter difficulty or confusion.
➢ Navigation
Navigation in the app is user friendly. The search bar is located at the top.
The menu option, accounts, address selection etc are all properly labelled
making it easy to navigate with one hand. The use of icons alongside the
labels enhances recognition and usability.
Page 5 of 14
[Document title]
Page 6 of 14
[Document title]
Page 7 of 14
[Document title]
Page 8 of 14
[Document title]
Page 9 of 14
[Document title]
➢ Syntax: Each programming language has its own syntax or set of rules that
govern how programs are written and structured. Enforcing type safety helps
catch type-related errors during compilation rather than at runtime, reducing
the chances of unexpected behavior or crashes.
Example: Basic syntax of C
//hello world
#include <stdio.h>
// Defining a main function
void main()
{
// code
printf("Hello World!");
}
Page 10 of 14
[Document title]
Page 11 of 14
[Document title]
Uses of Assertion:
1. Debugging
2. Input Validation
3. Program correctness
4. Testing and quality assurance
5. Error handling
To write reliable code for the banking application, assertions can be utilized to
validate various conditions and ensure the integrity of the transaction data.
The assertions check conditions such as:
1.The account pointer is not NULL.
2.The amount deposited or withdrawn is greater than zero.
3.The resulting balance after the transaction does not exceed the maximum
allowed balance.
By using these assertions, the program can catch potential issues early on,
such as invalid inputs or exceeding the account's balance limits, ensuring the
reliability of the banking application. When running the program, the
successful transactions will display appropriate messages with the updated
balance. However, the invalid scenarios will trigger assertion failures,
terminating the program and providing error messages indicating the specific
conditions that were violated.
Page 12 of 14
[Document title]
➢ waitpid: The waitpid() system call is used to wait for the completion of a
specific child process and retrieve its termination status. It allows a parent
process to pause its execution until one of its child processes exits or
terminates.
➢ open: The open() system call is used to open a file or create a new file in the
file system. It provides a way to access files for reading, writing, or both,
depending on the specified flags.
➢ close: The close() system call is used to close a file descriptor after you have
finished using it. It releases the resources associated with the file descriptor
and makes it available for reuse by the system.
Page 13 of 14
[Document title]
if (WIFEXITED(status))
{
int exit_status = WEXITSTATUS(status);
printf("Child process exited with status: %d\n", exit_status);
}
else if (WIFSIGNALED(status))
{
int signal_number = WTERMSIG(status);
printf("Child process terminated by signal: %d\n",
signal_number);
}
}
return 0;
}
Page 14 of 14