System Programming and Computer Control Systems
Task 1:
Control structures, Functions, Arrays and Bitwise Operations
a) Write a C program to find prime numbers up to n. The value of n should be between 6 and 30. If the value of n is less than 6 or greater than 30 it should display a relevant message
b) Write a C program to find out the sum of digits of any given number using recursion. The number should have a minimum of 4 digits and it should be your student ID. For example, if the input is 1234 then the output should be 1+2+3+4=10.
c) Write a C program for the swapping of two arrays. The output should display the two arrays before swapping and after swapping.
d) Write a C program to accept a decimal number as input and to find its binary representation and also to check if all the bits of generated binary number are bit 1 or not. If all bits are not 1 then it should display how many 1 and 0 are in the binary. For example if the input is 7 then it should display the same number 7. Its binary 111 and also a message mentioning all bits in binary 111 are bit 1 or not. The input should be between 10 and 200.
Task 2:
Virtual Instrument- LabVIEW
a) Using a graphical development environment (LabVIEW) make a Virtual Instrument (VI) for the following expressions/statements. All components of each block diagrams should be clearly explained. Also for each output a step-by-step explanation should be written at the end of the diagrams.
(i) z = (3 >> x) + (5 << y)
(ii) z = (x2^ 2)|(y & 1)
(iii) if ((a + b) >= 4)
c = (a - 2) + (b * 3)
else
c = (a + 5) * (b - 2)
Task 3:
Inter Process Communication and Files
a) Write a C program to pass integer values between parent and child processes using pipe() system call and fork() function.
b) Write a C program to send signal from child process to parent process
c) Write a C program to copy a file to another and to display a message when the file is copied. It should accept source and destination file names from command line. If source and destination files are not typed on command line, an error message should be displayed.
Task 4:
Dynamic Memory Allocation and Data Structures
a) Write a C program to implement a queue of integer data using a linked list. Create a suitable menu system that will allow the user to perform the following operations:
1. Enqueue
2. Dequeue
3. Display queue elements
4. Display queue size
5. Return front element of queue
6. Check if queue is empty
7. Quit from the application