Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CS 795 Midterm Exam, Spring 2005 - Prof. Ravi Mukkamala, Exams of Computer Science

The cs 795 midterm exam for the spring 2005 semester. The exam covers various topics in computer science, including coding exercises, static and dynamic code analysis, control flow graphs, and aliasing. Students are required to complete the exam and submit it by a specified deadline.

What you will learn

  • What is an upper bound on the number of edges in the control flow graph for a program with n statements?
  • What is required for question 1 in the CS 795 Midterm Exam?
  • Why are Weiser's mappings from actual to formal and formal to actual parameter names needed?
  • Which commercial and academic code analysis tools should be found for question 2?
  • Can static and dynamic code analysis tools detect all occurrences of uninitialized variables?
  • What is an alias introduced through function parameters?

Typology: Exams

2019/2020

Uploaded on 11/25/2020

koofers-user-u5e-1
koofers-user-u5e-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 795: Midterm
Spring 2005
Mail to cmo by Mar. 1
1. (10 pts) Complete the homework from slide set 3, slide 11.
2. (15 pts) Find several commercial code analysis tools. Describe briefly what
they to. Bonus point for finding free academic tools from active research
projects.
/* 1 */ /* Sample code for slicing exercise. v. 2/21/05 */
/* 2 */ #include <iostream.h>
/* 3 */ void main()
/* 4 */ {
/* 5 */ const int reps=10;
/* 6 */ int i;
/* 7 */ int a, b, c, d;
/* 8 */ cin >> a;
/* 9 */ cin >> b;
/* 10 */
/* 11 */ c = 2*a + a*b;
/* 12 */ d = 3*a + b;
/* 13 */ for ( i=0; i<= reps; i++ )
/* 14 */ {
/* 15 */ if ( c < 0 )
/* 16 */ {
/* 17 */ a = 2*a;
/* 18 */ c = c+5;
/* 19 */ }
/* 20 */ else
/* 21 */ {
/* 22 */ c = 2*a + a*b;
/* 23 */ d = 3*a + b;
/* 24 */ }
/* 25 */ }
/* 26 */ cout << c << endl;
/* 27 */ }
3. (25 pts) For the provided program, let C=< 27, {c} >. To do this, for each
statement in the program, compute R0C(n), B0c(n), and S0c(n), INFL(n), along
with higher orders (R1C(n), etc.
pf2

Partial preview of the text

Download CS 795 Midterm Exam, Spring 2005 - Prof. Ravi Mukkamala and more Exams Computer Science in PDF only on Docsity!

CS 795: Midterm

Spring 2005

Mail to cmo by Mar. 1

1. (10 pts) Complete the homework from slide set 3, slide 11.

2. (15 pts) Find several commercial code analysis tools. Describe briefly what

they to. Bonus point for finding free academic tools from active research

projects.

/* 1 / / Sample code for slicing exercise. v. 2/21/05 / / 2 / #include <iostream.h> / 3 / void main() / 4 / { / 5 / const int reps=10; / 6 / int i; / 7 / int a, b, c, d; / 8 / cin >> a; / 9 / cin >> b; / 10 / / 11 / c = 2a + ab; / 12 / d = 3a + b; /* 13 / for ( i=0; i<= reps; i++ ) / 14 / { / 15 / if ( c < 0 ) / 16 / { / 17 / a = 2a; /* 18 / c = c+5; / 19 / } / 20 / else / 21 / { / 22 / c = 2a + ab; / 23 / d = 3a + b; /* 24 / } / 25 / } / 26 / cout << c << endl; / 27 */ }

3. (25 pts) For the provided program, let C=< 27, {c} >. To do this, for each

statement in the program, compute R^0 C(n), B^0 c(n), and S^0 c(n), INFL(n), along

with higher orders (R^1 C(n), etc.

4. (15 pts) Transform the program of question 2 into an equivalent program

containing only sequence, assignment, if, if-then-else and while-do. Then find

the Bergeretti and Carré information-flow relations λs, μs, and ρs where S is

your transformed program.

Request: I haven’t done this, and some of the tasks can get more time

consuming than they are worth. Please plan to give me a progress report in

class or by e-mail if it starts to take a lot of time.

5. (10 pts) For a program with n statements, what is an upper bound on the

number of edges in the control flow graph for that program? Justify your

answer.

6. (10 pts) Can a static code analysis tool detect all occurrences of uninitialized

variables? Justify your answer.

7. (10 pts) Can a dynamic code analysis tool detect all occurrences of

uninitialized variables? Justify your answer.

8. (10 pts) Give an example (through a code fragment) of an alias which is

introduced through function parameters.

9. (10 pts) It is asserted in slide set two that "At some point, Sci+1^ will equal

Sic". Explain why this is so.

10. (10 pts) In order to deal with functions, Weiser introduces two

mappings, one from actual parameter names to formal parameter

names, the other from formal parameter names to actual parameter

names. Why are these needed?