No. 1 Fresher Jobs Website in India.
Are you employer? Register to Post Jobs Login
Search Jobs

Mt Carmel College, Bangalore ,14 January 2007 by SUBEX

Details of Mt Carmel College, Bangalore ,14 January 2007 by SUBEX conducted by SUBEX for job interview.
Share Us With Others
SUBEX PAPER ON 14th JANUARY AT BANGALORE

Hi All,

I attended the test on 14th Jan 2007 conducted by Subex Azure ltd.The paper had C programming mainly on pointers.

Part 1: 20 questions in C (1/2 an hour duration)

Part2: A program to be written (1/2 an hour)

Part1:

Assume

sizeof(char) = 2

sizeof(int) = 4

sizeof(float) = sizeof(pointer) = 4

sizeof(double) = 8

1.

#define _LINE_ 10

main()

{

printf("%d",_LINE_);

}

2.

#define STRINGDEF(expr) #expr

printf(STRINGDEF(10));

3.

calculate the following postfix expression

+ * + 2 6 - 1 5 6

4.

int i = 260;

float f = 12.2;

char c = ,a,;

char *ptr1,*ptr2,*ptr3;

ptr1 = (char *)&i;

ptr2 = (char *)&f;

ptr3 = (char *)&c;

printf ("%c|%c|%c",*ptr1,*ptr2,*ptr3);

options:

a. 260|12|97

b. 260|12|a

5.

int main(int argc,char **argv)

{

int *p;

p = malloc(10 * sizeof(int i));

realloc(p,0);

/*(i) */

return 0;

What is the state of the marked line (i)?

options:

a. dangling pointer p

b. defined

c. memory leakage during malloc

6.

main()

{

int i = 0;

if(i++,i)

return 1;

else

return 0;

}

options:

1.Always 0

2.Always 1

7.

struct

{

unsigned int is_keyword : 1;

unsigned int is_extern : 1;

unsigned int is_static : 1;

}flag;

/*print the value of is_keyword */

options:

1. Compile error

2. 1

3. Error, before the :

8.

int foo(void)

{

char *p;

int i;

if (i && (*p=10))

return 1;

else

return 0;

}

what will be the outcome if the foo function is called ?

9.

int m =1;

int l =0;

int i = -1;

int j =1;

....

for(; i > 4))

/*sorry i do not exactly remember the for loop,but it actually look like the above for loop */

.....

How many times will the loop execute,

options:

a. 8

b. 1

c. infite times

10.

struct

{

char *p;

int i;

}mem;

....

struct mem member = {"value, 3"},2;

....

options:

1. compile erroe

2. state defined

11.

struct

{

char *name;

int i;

union

{

char var;

int integer;

float var2;

}

}ARRAY_SIZE(10);

....

//see the above assumptions

printf("%d",sizeof(ARRAY_SIZE));

....

options

1.20

2.200

3.16

4.160

and rest i do not remember....

but lot on pointers and preprocessors.

Part2:

Write a program to get strings and to substitute character from string1 to string2

(equv to UNIX command tr)

for example:

string1: "abc"

string2: "def"

the occurrence of ,a, will be replaced by ,d, , ,b, will be replaced by ,e, , ,c, will be replaced by ,f,

AND for less complexity assume the string1 and string2 are of same size
thatz all guys...