Select chapter



functions (3.papers)
loops (1.papers)
arrays (2.papers)
structures (3.papers)
unions (1.papers)
pointers (7.papers)
null pointers (1.papers)
strings (2.papers)
misc c concepts (1.papers)
Data structures (5.papers)
linked lists (3.papers)
trees (1.papers)
basics (5.papers)
Hide

Sponsored Links


  

c misc c concepts interview questions and answers

1
what is the difference between memcpy and memmove functions in c?
  1. memcpy - copies source to destination with out checking for overlapping of source and destination memory areas. memmove - copies source to destination carefully by checking for overlapping of source and destination memory areas.
  2. Reverse of Option 1 is true.
  3. option 1 is right, and memcpy is faster than memmove, memcpy may overwrite memory areas.
  4. option 2 is right, and memmove is faster than memcpy, memmove may overwrite memory areas.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
4
what does fork() function-call does in a linux c program?
  1. it creates one more thread in the current process
  2. it creates one more process (child) from current(parent) process
  3. it creates two more processes(children) from current(parent) process.
  4. it just splits current task into two with out creating extra threads or processes.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
6
fork() in c:

What is the output of below C program?

#include  <stdio.h>

int main(void)
{
    int pid = fork();
    if(pid == 0)
         printf("child process \n");
    else
         printf("parent process \n");
    return 0;
}
  1. it prints child process twice and parent process twice
  2. it prints child process once and parent process twice
  3. it prints child process once and parent process once
  4. it prints only parent process.
Show Answer
Share Facebook gmail Twitter
7
fork process id c:

What is the output of below C program?
In below program what does printf prints in parent and child, and how many times printf gets executed?

#include  <stdio.h>

int main(void)
{

    int pid = fork();
    printf("%d ",pid);
    return 0;
}
  1. printf executes only once, it prints child process id in parent process
  2. printf executes twice, it prints child process id in parent process, and 0 in child process.
  3. printf executes twice, it prints 0 in parent process, and parent process id in child process.
  4. printf executes twice, it prints child process id in parent process, and parent process id in child process.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
9
What is an Orphan process in Linux?
  1. it is a child process that is already destroyed but its parent process it still alive.
  2. it is a child process whose parent process is terminated.
  3. it is a child process who is having more than one parent process.
  4. it is a child process which was created with out any parent process and by init process.
Show Answer
Share Facebook gmail Twitter
10
What is an Zombie process in Linux?
  1. it is a parent process that is already destroyed but its child process it still alive.
  2. it is a child process which has completed its execution (terminated).
  3. it is a parent process which has completed its execution (terminated) but still has entry in the process table to allow child process to get this parent process's exit status.
  4. it is a child process which has completed its execution (terminated) but still has entry in the process table to allow parent process to get this child process's exit status.
Show Answer
Share Facebook gmail Twitter
11
what will happen if malloc(int) doesn't allocate any memory in c? will it return any pointer?
  1. it returns false
  2. it returns null
  3. it returns void *
  4. it doesn't return any thing.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
13
what does getpid() function does in linux c program?
  1. it gets the priority of our program
  2. it gets the process id of our program
  3. it gets the thread id of our program
  4. it gets the processor id on which our program is running.
Show Answer
Share Facebook gmail Twitter
Read more papers :