1. Bansilal Ramnath Agarwal Charitable Trust’s
Vishwakarma Institute of Technology, Pune. 37
Principles of Programming Languages
CS 20105 – SE – E
Home Assignment 2
Assignment Date: 13th March 2012 Submission Date: 20th 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(“Hin”);
else {
i=0;
printf(“Hellon”);
main();
}
return 0;
}
Page 1 of 2
2. 4. What will be the output of following C code:
#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 values
c. Size of a pointer to int is 2 bytes while size of a pointer to char is 1byte
d. 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