CP Btech 08 Mid Sem 19 09 08
CP Btech 08 Mid Sem 19 09 08
Instructions:
1. Do Not Repeat Questions.
2. Answer New Question on New Page.
3. Q.1 to Q.8 are compulsory.
4. Q.9 is bonus question of 5 marks.
Q.1. State whether the following statements are true or false. [5]
A) Array occupies contiguous memory locations.
B) In c/c++, all arrays have 0 as the index of their first element.
C) Keywords can be used as variable names.
D) ASCII-7 uses leftmost 7 bits of a byte.
E) BCD is unable to store 26 lower case alphabets.
F) You can’t add an integer number to a pointer.
G) char name[] = “PDPU-IPTG” occupies 9 bytes in the memory.
H) strlen() returns length of a string.
I) strcmp() returns 0 if both strings are equal.
J) while(1); is an infinite loop statement.
Q. 4. Write the output for the following segment of the program. [5]
a) int i = 4 , j = 5; b) int a = 10, * b = &a, **c = &b;
if (++i > j - -) **c = *b + 10; c++;
cout << i << “ “ << j ; cout << *c;
cout << i << “ “ << j ; (if addresses of a ,b and c are 65524,
65522 & 65520 respectively.)
(Assume 16-bit compiler)
Page 1 of 2
PANDIT DEENDAYAL PETROLEUM UNIVERSITY
INSTITUTE OF PETROLEUM TECHNOLOGY, GANDHINAGAR
B.TECH 2008-MID-SEMESTER EXAM COMPUTER PROGRAMMING (ESC101)
Roll No. _____ Batch No. ____
Q.5. Find out 10 errors in the following segment of the program & rewrite it. [5]
main( ) Dbl(int x, int y);
{ {
int a = 10; b = 20; int x;
dbl(&a, &b); x = x + x;
cout >> a >> “ “ >> b; y = y + y;
} }
Page 2 of 2