# Sample Theoretical Question What’s printed on the screen when the following programs are run? printing.c change_val.c And what does this function do? secret.c.

## Presentation on theme: "Sample Theoretical Question What’s printed on the screen when the following programs are run? printing.c change_val.c And what does this function do? secret.c."— Presentation transcript:

Sample Theoretical Question What’s printed on the screen when the following programs are run? printing.c change_val.c And what does this function do? secret.c

Parentheses checking Implement a function such that – Input – A string s that contains (among other things) parentheses Output – 1 if the parentheses’ nesting is legal, 0 otherwise For example – (()())() is legal, while ())() and (()(()) are not. Write a program that accepts a string from the user and checks etc’.

Dynamic structures Write a structure of a point in 2-D space and a distance function between two points Write a program that gets an array of points from the user and calculates the largest distance between a pair of points in the array The size of the array is given by the user before the points are read in Solution – max_distance.c

Split list Implement a linked list where each item simply contains an integer Input a number n from the user, and split the original list into two lists such that the first contains all the elements smaller than n, and the other contains all the others Display both linked lists on the screen

String alignment Implement a function such that – Input – two strings, s1 and s2 Output – 1 if s2 is a substring-with- insertions of s1 For example, if s1 = “abcde” and s2 = “abe”, then the function should return 1 Solution – string_align.c

Printing maximum 20 Write a program that accepts integers from the user until a -1 is entered The program then prints the maximum 20 numbers Not necessarily sorted! Solution – maximum_20.c

Printing maximum n Change the previous program so that the first number the user enters is the number of numbers she wants printed So if the first number is 5, the top 5 numbers will be printed Solution – maximum_n.c

Download ppt "Sample Theoretical Question What’s printed on the screen when the following programs are run? printing.c change_val.c And what does this function do? secret.c."

Similar presentations