Previous Years Solved Sample Placement Papers
- What is the output in the following program?
main() { char c = -64; int i = -32; unsigned int u = -16; if (c > i) { printf("pass1,"); if (c) printf("pass2"); else printf("Fail2"); } else printf("Fail1"); if (i) printf("pass2"); else printf("Fail2"); }
(A) Pass1,Pass2
(B) Pass1,Fail2
(C) Fail1,Pass2
(D) Fail1,Fail2
(E) None of these
Ans: C
- In the process table entry for the kernel process, the process ID value is:
(A) 0
(B) 1
(C) 2
(D) 255
(E) It does not have a process table entry
Ans: A
- Which of the following API is used to hide a window?
(A) ShowWindow
(B) EnableWindow
(C) MoveWindow
(D) SetWindowPlacement
(E) None of the above
Ans: A
- What will the following program do?
void main() { int i; char a[] = "String"; char *p = "New String"; char *Temp; Temp = a; a = malloc(strlen(p) + 1); strcpy(a, p); // Line number: 9 // p = malloc(strlen(Temp) + 1); strcpy(p, Temp); printf("(%s, %s)", a, p); free(p); free(a); } // Line number 15 //
(A) Swap contents of p & a and print: (New string, string)
(B) Generate compilation error in line number 8
(C) Generate compilation error in line number 5
(D) Generate compilation error in line number 7
(E) Generate compilation error in line number 1
Ans: B
- In the following code segment, what will be the result of the function?
Value of x, value of y { unsigned int x = -1; int y; y = ~0; if (x == y) printf("same"); else printf("not same"); }
(A) same, MAXINT, -1
(B) not same, MAXINT, -MAXINT
(C) same, MAXUINT, -1
(D) same, MAXUINT, MAXUINT
(E) not same, MAXINT, MAXUINT
Ans: A
- PATH = /bin:/usr:/yourhome
The file /bin/calendar has the following line:
cal 10 1997
The file /yourhome/calendar has the following line:
cal 5 1997
If the current directory is /yourhome and "calendar" is executed:
(A) The calendar for May 1997 will be printed on the screen
(B) The calendar for Oct 1997 will be printed on the screen
(C) The calendar for the current month (whatever it is) will be printed
(D) Nothing will get printed on the screen
(E) An error message will be printed
Ans: B