Samsung Previous Years Solved Sample Placement Papers
-
What is the output of the program?
char *c = 'a'; printf("%d %d %d", sizeof(c), sizeof('a'), sizeof(*c));
A. 4, 1, 1 Answer: Option A
-
class abc { static int i; int a; }; abc ob; cout << sizeof(ob);
ANS: 8
-
class abc { }; abc ob; cout << sizeof(ob);
Ans: 1 (size of object of empty class is 1)
-
int i = 512; char *c = (char *)&i; c[0] = 1; printf("%d", i);
Ans: 513
-
int *b = {1, 2, 3, 4, 5, 6, 9, 8}; printf("%d", (b + 1)[5]);
Ans: Error
-
static int i; main() { if (i == 5) printf("Samsung"); i++; return (i = main()); }
Ans: Stack Overflow
-
main() { printf("%s", printf("Samsung") + fun()); } fun() { return "electronic"; }
Ans: Samsung
-
char *a = "hello\0world\0!!"; printf("%d", strlen(a)); a = a + 6; printf("%d", strlen(a)); a = a + 7; printf("%d", strlen(a));
Ans: 5, 5, 1
-
struct abc { }; struct abc arr[10]; struct abc *p = arr; Which will be increment the pointer to point the next array element?
Ans: p = p + sizeof(abc);
-
int main() { char a = '\0'; printf("%d", a); return 0; }
Ans: 0
-
When does the CPU service interrupt?
A. after executing the current instruction Answer: Option A
-
On switch on the computer, which loader comes in action first?
Ans: Boot Strap Loader
-
Which of the following are not related to the file system?
Ans: files are in main memory
-
How many nodes will make a complete binary tree?
Ans: 15
-
Property of Heap?
Ans: Every Node is Greater Than its Child
-
In the case of recursion, what is overhead?
Ans: Stack
-
Which languages necessarily need heap allocation in the runtime environment?
A. Those that support recursion
B. Those that use dynamic scoping
C. Those that allow dynamic data structures Answer: Option C
D. Those that use global variables
-
main() { int i = -1; -i; printf("%d", i); return 0; }
Ans: -1
-
main() { char *p; printf("%d %d", sizeof(*p), sizeof(p)); }
Answer: 1, 4
-
How many times will printf be executed?
main() { for (int i = -1; i <= 10; i++) { if (i == 5) continue; else break; printf("samsung"); } }
Ans: 0 times