Vidyalelo
Computer Science · all questions

Linux
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

996

Questions

27/50

Page

Pick an option on a question to see the right answer and solution.

Which of the following is considered as the super daemon in Unix?

Select an option to see the answer and solution.

Which of the following umask settings allow execute permission to be set by default on regular files

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<fcntl.h>
 
int main()
{
    int fd, count;
    char ch;
    fd = open("demo.txt",O_RDWR|O_CREAT);
    write(fd,"s",1);
    lseek(fd,0,SEEK_SET);
    write(fd,"d",1);
    lseek(fd,0,0);
    read(fd,&ch,1);
    printf("%c\n",ch);
    return 0;
}

Select an option to see the answer and solution.

How do you add (append) a file "file1" to the example.tar file

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<sys/mman.h>
 
int main()
{
    int s_id;
    int *ptr;
    s_id = shm_open("shared_mem",O_CREAT|O_RDWR,0666);
    if(s_id == -1)
        perror("shm_open");
    ptr = mmap(NULL,100,PROT_WRITE,MAP_PRIVATE,s_id,0);
    if(ptr == MAP_FAILED);
        perror("mmap");
    ptr = mmap(ptr,100,PROT_WRITE,MAP_PRIVATE,s_id,0);
    if(ptr == MAP_FAILED);
        perror("mmap");
    if(munmap(ptr,100) == -1)
        perror("munmap");
    if(shm_unlink("shared_mem") == -1)
        perror("shm_unlink");
       return 0;
   }

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<string.h>
 
int main()
{
    int fd[2];
    int count;
    char buffer[6];
    if( pipe(fd) != 0)
        perror("pipe");
    memset(buffer,'\0',6);
    count=write(fd[1],"Linux",6);
    read(fd[0],buffer,6);
    printf("%s\n",buffer);
    return 0;put
}

Select an option to see the answer and solution.

In sysfs the device drivers of same . . . . . . . . are expected to provide same functionalities to the user mode application.

Select an option to see the answer and solution.

This program will print
#include<stdio.h>
#include<signal.h>
#include<unistd.h>
 
void response (int);
void response (int sig_no)
{
    printf("%s is working\n",sys_siglist[sig_no]);
}
int main()
{
    alarm(5);
    sleep(50);
    printf("Example\n");        
    signal(SIGALRM,response);
    return 0;
}

Select an option to see the answer and solution.

What is the role of linker in the compilation process?

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
 
int main()
{
    int *ptr1, *ptr2;
    ptr1 = malloc(4);
    *ptr1 = 10;
    *ptr2 = free(ptr1);
    printf("%d\n",*ptr2);
    return 0;
}

Select an option to see the answer and solution.

The makefile starts executing from

Select an option to see the answer and solution.

To use the static library in the program

Select an option to see the answer and solution.

Which file contains the boot options passed to the kernel?

Select an option to see the answer and solution.

In GDB which one of the following allows us to specify a variable in terms of the file or function where it is defined?

Select an option to see the answer and solution.

Using which command you find resource limits to the session?

Select an option to see the answer and solution.

Which niceness value among the following indicate most favorable scheduling?

Select an option to see the answer and solution.

Which command removes a directory from directory stack?

Select an option to see the answer and solution.

Which one of the following variables is used within GDB to hold on to a value and refer to it later?

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
struct st{
    int a;
    char b;
};
 
int main()
{
    struct st *st_ptr;
    st_ptr = malloc(sizeof(struct st));
    printf("%d\n",sizeof(struct st));
    return 0;
}

Select an option to see the answer and solution.

To feed standard output of one command to standard input of another in a single shell session

Select an option to see the answer and solution.