CSE 2320 - Assignments

Not Graded Practice for Assignment 4

This is a set of practice questions. Feel free to work on these questions, and to ask questions if you face any difficulties in coming up with answers. While collaboration with others on the graded homework is strictly prohibited, you are free to work on these practice questions together with other people.

Since they are practice questions, you do not have to, and should not, submit answers to these questions on Blackboard. These questions will not be considered in any way towards your course grade. At the same time, based on the instructor's experience, individuals spending substantial and systematic effort in answering these practice questions by themselves tend to significantly improve their overall class performance.


Practice Question 1

(This is Problem 3.59 from the textbook).

Write a function that takes a string as an argument and reads a sequence of words (sequences of characters separated by blank space) from standard input, printing out those words that appear as substrings somewhere in the parameter string.


Practice Question 2

(This is Problem 3.62 from the textbook).

Write an efficient function that takes a string as an argument and returns the length of the longest sequence of blanks in that string, examining as few characters in the string as possible. Hint: Your program should become faster as the length of the sequence of blanks increases.


Practice Question 3

(This is Problem 3.65 from the textbook).

Write a program to fill in a two-dimensional array of 0-1 values by setting a[i][j] to 1 if the greatest common divisor of i and j is 1, and to 0 otherwise.


Back to the list of assignments.