0% found this document useful (0 votes)
38 views2 pages

HW02 20222

The document provides 10 problems for a homework assignment on embedded systems programming. Students are instructed to write functions to solve each problem rather than putting all the code in the main function. The problems include rewriting programs from the previous homework to use functions, writing functions to sort names, reverse strings by word, replace words in a string with asterisks, convert strings to integers, check for palindromes, remove extra blanks from strings, find character frequencies in a string, write student data to a CSV file, and read a student data file to calculate grade distributions.

Uploaded by

Minh Lâm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

HW02 20222

The document provides 10 problems for a homework assignment on embedded systems programming. Students are instructed to write functions to solve each problem rather than putting all the code in the main function. The problems include rewriting programs from the previous homework to use functions, writing functions to sort names, reverse strings by word, replace words in a string with asterisks, convert strings to integers, check for palindromes, remove extra blanks from strings, find character frequencies in a string, write student data to a CSV file, and read a student data file to calculate grade distributions.

Uploaded by

Minh Lâm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Hanoi University of Science and Technology Fundamentals of Embedded Systems

Semester 1, Academic Year 2022/2023 EE3490E - Kĩ thuật lập trình


Lecturer: Hoàng Đức Chính

Homework 2
Students need to design other function(s) rather than writing everything in the main() function to solve the
problems below.

Problem 1:
Rewrite the programs in Homework 1 using functions and demonstrate the function usage

Problem 2:
Write a function to sort the names in a given list in ascending order and demonstrate the usage

Problem 3:
Write a function to obtain a string entered via keyboard in the reverse order as per word, e.g. “How
Are You” change to “You Are How”. Write a program to demonstrate the usage.

Problem 4:
Write a program to enter a sentence (or paragraph) and a word (or a string), then replace the word
(string) within the sentence (paragraph) with the equal number of "*" at all occurring. Design and use
appropriate functions to perform the task.

Problem 5:
Write a function that converts a string like “124” to an integer 124. Write a program to demonstrate
the usage.

Problem 6:
Write a function to check whether string inputted by user is palindrome or not. Demonstrate the
usage

Problem 7:
Write a function to remove all the extra blanks in a string. Demonstrate the usage

Problem 8
Write a program to enter any string and print the frequency of each character within the string. The
character with multiple frequencies should be displayed only once in the output, with the frequency value.
Design and use appropriate functions to perform the task.

Problem 9
Write a program to take a list of students in a programming class. The list should contain the student
id, student name and the final exam score. Write the student list to a csv file call “ee3490E.csv” such that
each line consists of student id, student name and the score. Each field of information should be separated by
a comma “,”; e.g.: 20200001,Adam Smith,8.2. Design and use appropriate functions and data types to
perform the task.

Problem 10
Write a program to read a file which has the same format as described in problem 9. Calculate the
number of students who get A, B, C, D, and F. Design and use appropriate functions and data types to
perform the task.

You might also like