- Edited
Hey guys,
I've got my final exam coming up this Monday. I got the final exams of the last couple of years from my faculty's print-press. I thought I'd share some of them with you, maybe someone would enjoy solving them. I haven't tried to solve them yet, I'll be doing that over the next few hours. I'll provide the answers to the exercises if I were able to solve them.
1. Give a C function reverse that takes an integer array and its length as arguments and reverses the array in place. Show how to use this function in a main program. Your program should accept the size of the array and the list of the array. Maximum size of array is 20.
2. Write a program that accepts two 5x5 matrices, swap their diagonals, and then print both matrices. The program should have two functions one that accepts 5x5 matrix and the other print 5x5 matrix.
3. Write a program that inputs a line of string up to 50 characters. After reading the string, the program should count all punctuations and print results. You need to create a pointer that scans the string to look for punctuation. Also, use the built-in function in ctype.h to check for punctuation. *
4. Write a C program that accepts two strings up to 15 characters each. The program should compare both strings and concatenate them with smaller first. The final string should be saved in a declared 30 character string and printed out. The program should also print the size of the final string. *
* These are not required for my exam because we couldn't take strings in C because of several strikes and vacations.
Enjoy :)
P.S: I know AymanFarhat would enjoy this post ;)
I've got my final exam coming up this Monday. I got the final exams of the last couple of years from my faculty's print-press. I thought I'd share some of them with you, maybe someone would enjoy solving them. I haven't tried to solve them yet, I'll be doing that over the next few hours. I'll provide the answers to the exercises if I were able to solve them.
1. Give a C function reverse that takes an integer array and its length as arguments and reverses the array in place. Show how to use this function in a main program. Your program should accept the size of the array and the list of the array. Maximum size of array is 20.
2. Write a program that accepts two 5x5 matrices, swap their diagonals, and then print both matrices. The program should have two functions one that accepts 5x5 matrix and the other print 5x5 matrix.
3. Write a program that inputs a line of string up to 50 characters. After reading the string, the program should count all punctuations and print results. You need to create a pointer that scans the string to look for punctuation. Also, use the built-in function in ctype.h to check for punctuation. *
4. Write a C program that accepts two strings up to 15 characters each. The program should compare both strings and concatenate them with smaller first. The final string should be saved in a declared 30 character string and printed out. The program should also print the size of the final string. *
* These are not required for my exam because we couldn't take strings in C because of several strikes and vacations.
Enjoy :)
P.S: I know AymanFarhat would enjoy this post ;)