ppl home assignment_unit2

Post on 20-Jan-2015

178 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Bansilal Ramnath Agarwal Charitable Trust’sVishwakarma Institute of Technology, Pune. 37

Principles of Programming LanguagesCS 20105 – SE – E

Home Assignment 2

Assignment Date: 13 th March 2012 Submission Date: 20 th March 2012

Answer all 13 questions:

1. What are Imperative Languages? Is there any difference between Imperative Languages and Procedural Languages?

2. What is meant by operator associativity and operator precedence? If x, y and z have values 40, 4 and 10 respectively, what will be the values of x, y and z after executing the following statement:

z+=(x>20 && x<=50)?x++:x/y;

3. What will be the output of following C code:

#include <stdio.h>int main() {

int i=1;if(!i)

printf(“Hi\n”);else {

i=0;printf(“Hello\n”);main();

}return 0;

}

4. What will be the output of following C code:

Page 1 of 2

#include <stdio.h>int main() {

int i=5;while (i<10);{

printf(“%d “,i);i++;

}printf(“%d”, i);return 0;

}

5. True or False? (for C language)a. Whatever you can do using ‘for’ you can also do using ‘while’b. Switch-Case always works for constant integer valuesc. Size of a pointer to int is 2 bytes while size of a pointer to char is 1byted. Pointers in C are primitive types

6. What is the difference between a “strongly typed” language and a “weekly typed” language?

7. When do you use “structures” and when do you use “union” in C? Explain with examples.

8. If p is declared as a pointer to an integer, is there any difference between *p++ and (*p)++?

9. What is a “reference” type in C++?

10. What is meant by “parameter passing”? What are some parameter passing methods generally used?

11. What does an “Activation Record” contain?

12. What are generic templates in C++ and what is their use? Explain with an example.

13. What are containers, algorithms and iterators in C++ STL? What are they used for?

Page 2 of 2

top related