Sr Software Developer Interview Questions

7,039 sr software developer interview questions shared by candidates

1. Define a void function for the below program,such that after the <function call> execution, the pointer p is allocated with 100 bytes. Define and call the new function in place of <function call>. This new function should be a void function void GetMemory(int ** a_ptr); #define X_SIZE (100) main() { int *p; GetMemory(&p) } void GetMemory(int ** a_ptr) { *a_ptr = (int*)malloc(X_SIZE * sizeof(int)) if(*a_ptr == NULL) { pf("Out of memory") } } 2. Induce Segmation default int *p; printf("%d", p[0]); 3. Function pointer int(*Function_ptr)(int,int); int Fun(int a, int b); int main() { int ret = 0; Function_ptr pf = NULL; pf = Fun; ret= pf(5, 10); printf("%d", ret); } 4. Output int *p1 = 0x1000; char *p2 = 0x1000; void *p3 = 0x1000; double *p4 = 0x1000; p1++; p2++; p3++; p4++; spanning tree algorithm Have you managed a team. L2/L3 protocal.
avatar

Senior Software Developer

Interviewed at HCLTech

3.5
Nov 19, 2020

1. Define a void function for the below program,such that after the <function call> execution, the pointer p is allocated with 100 bytes. Define and call the new function in place of <function call>. This new function should be a void function void GetMemory(int ** a_ptr); #define X_SIZE (100) main() { int *p; GetMemory(&p) } void GetMemory(int ** a_ptr) { *a_ptr = (int*)malloc(X_SIZE * sizeof(int)) if(*a_ptr == NULL) { pf("Out of memory") } } 2. Induce Segmation default int *p; printf("%d", p[0]); 3. Function pointer int(*Function_ptr)(int,int); int Fun(int a, int b); int main() { int ret = 0; Function_ptr pf = NULL; pf = Fun; ret= pf(5, 10); printf("%d", ret); } 4. Output int *p1 = 0x1000; char *p2 = 0x1000; void *p3 = 0x1000; double *p4 = 0x1000; p1++; p2++; p3++; p4++; spanning tree algorithm Have you managed a team. L2/L3 protocal.

Viewing 4851 - 4860 interview questions

Glassdoor has 7,039 interview questions and reports from Sr software developer interviews. Prepare for your interview. Get hired. Love your job.