1) What is the output of the following program
#include <stdio.h>
int main()
{
char *p = NULL ;
printf("%d%s\n", p, *p) ;
}
Results:
1) Warnings
int.c:5:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]
printf("%d%s\n", p, *p) ;
^
int.c:5:2: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
2) IF compiled, it will crash.
2) what are different types of communication(IPC)
Pipes, message queues, shared memory, signals.
Does pipes can be used between childs of same parent.
IF single shell, having multiple processes. Can pipe will be used? No
3) how routing table lookup takes place
It uses IP address and subnet mask to fetch the best matching route.
4) How to decide the router to send the packet to upper layer or lower layer
router needs to determine based on the destination ip address present in the packet. If its own ip, then forward to L2 layer else forward to L4(tcp) layer.
5) which data structure will be used in routing table.
Tries.
6) Why hash tables are used.
They are good in insertion, deletion and search. All operations takes place with o(1) complexity.
7) If chaining is required, then why need to use Hash table.
At very first hand, we are not aware whether is there any duplicates will be present or not. Eventhough chaining will take O(n) time, still prefer hash.
8) Is message queues are synchronous or asynchronous?
Asynchronous
9) What are the different signals cannot be catched?
SIGKILL and SIGSTOP
10) Why threads are used over processes.
Two reasons
a) Communication between thereads are faster. Context swiching between threads is faster.
b) Easy to share the data between threads.
Other points
a) faster
b) need synchronization data between processes.
c) etc
Few more questions
1) How server will handle multiple clients?
2) what are vtables for pure virtual functions?
3) how malloc and free works
4) which ipc mechanism used for
5) what happen for child process whose parent is died
6) what is mutex and binary semaphore. Differences
1) which pattern will be used for memory management.
2) How the memory layout for dynamic libraries used for 2 processes.
3) why map.erase() will not work? what are the other operations should we use for deletion of entries in map.
4) What happens if destructor is called in private section of class.
5) Have you used templates?
6) why "this" is a pointer?
7) How gdb works internally?
8) what happens when you set a break point in GDB.
9) Does all the symbols will be loaded in GDB.
#include <stdio.h>
int main()
{
char *p = NULL ;
printf("%d%s\n", p, *p) ;
}
Results:
1) Warnings
int.c:5:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]
printf("%d%s\n", p, *p) ;
^
int.c:5:2: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
2) IF compiled, it will crash.
2) what are different types of communication(IPC)
Pipes, message queues, shared memory, signals.
Does pipes can be used between childs of same parent.
IF single shell, having multiple processes. Can pipe will be used? No
3) how routing table lookup takes place
It uses IP address and subnet mask to fetch the best matching route.
4) How to decide the router to send the packet to upper layer or lower layer
router needs to determine based on the destination ip address present in the packet. If its own ip, then forward to L2 layer else forward to L4(tcp) layer.
5) which data structure will be used in routing table.
Tries.
6) Why hash tables are used.
They are good in insertion, deletion and search. All operations takes place with o(1) complexity.
7) If chaining is required, then why need to use Hash table.
At very first hand, we are not aware whether is there any duplicates will be present or not. Eventhough chaining will take O(n) time, still prefer hash.
8) Is message queues are synchronous or asynchronous?
Asynchronous
9) What are the different signals cannot be catched?
SIGKILL and SIGSTOP
10) Why threads are used over processes.
Two reasons
a) Communication between thereads are faster. Context swiching between threads is faster.
b) Easy to share the data between threads.
Other points
a) faster
b) need synchronization data between processes.
c) etc
Few more questions
1) How server will handle multiple clients?
2) what are vtables for pure virtual functions?
3) how malloc and free works
4) which ipc mechanism used for
5) what happen for child process whose parent is died
6) what is mutex and binary semaphore. Differences
1) which pattern will be used for memory management.
2) How the memory layout for dynamic libraries used for 2 processes.
3) why map.erase() will not work? what are the other operations should we use for deletion of entries in map.
4) What happens if destructor is called in private section of class.
5) Have you used templates?
6) why "this" is a pointer?
7) How gdb works internally?
8) what happens when you set a break point in GDB.
9) Does all the symbols will be loaded in GDB.
No comments:
Post a Comment