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

26/50

Page

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

Linux filesystem contains mainly

Select an option to see the answer and solution.

Race condition can be avoided by using

Select an option to see the answer and solution.

Shell is ?

Select an option to see the answer and solution.

Which system call is used to create Sys V message Queue.

Select an option to see the answer and solution.

Binary or executable files are:

Select an option to see the answer and solution.

Which variable contains current shell process id

Select an option to see the answer and solution.

Proc filesystem does not contains

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/msg.h>
 
struct data_st{
    long int id;
    char buff[11];
};
int main()
{
    int m_id,ret;
    struct data_st data1, data2;
    m_id = msgget((key_t)181,0666|IPC_CREAT);
    if(m_id == -1)
        perror("msgget");
    data1.id = 1;
    strcpy(data1.buff,"Example");
    if(msgsnd(m_id,&data1,11,0) == -1)
        perror("msgsnd");
    ret = msgrcv(m_id,&data2,11,1,0);
    printf("%d\n",ret);     
    if(msgctl(m_id,IPC_RMID,0) != 0)
        perror("msgctl");
    return 0;
}

Select an option to see the answer and solution.

What is output of the following program?
int main() 
{     
	fork();       
	fork();        
	fork();       
	if (wait(0) == -1)          
	printf("leaf child\n");  
}

Select an option to see the answer and solution.

On which system call, this program (process) waits until the server responds?
#include<stdio.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/socket.h>
 
int main()
{
    int fd_client,fd, len;
    struct sockaddr_in add_server;
    fd_client = socket(AF_INET,SOCK_STREAM,0);
    if (fd_client == -1){
        perror("fd_sock");
        exit(1);
}
add_server.sin_family = AF_INET;
add_server.sin_port = ntohs(4001);
add_server.sin_addr.s_addr = inet_addr("127.0.0.1");
len = sizeof(add_server);
fd  = connect(fd_client,(struct sockaddr*)&add_server,len);
if(fd == -1)
    perror("connect");
    write(fd,"Hello\n",6);
    return 0;
}

Select an option to see the answer and solution.

What is the output of the program?
#! /usr/bin/awk -f
BEGIN {
    a[1,1]=0
    a[1,2]=1
    a[2,1]=2
    a[2,2]=3
    for(i=1;i<3;i++) {
        for(j=1;j<3;j++) {
        print a[i,j]
        }
    }
}

Select an option to see the answer and solution.

The file system information is stored in

Select an option to see the answer and solution.

Mm_struct maintains?

Select an option to see the answer and solution.

SVR4 stands for?

Select an option to see the answer and solution.

Which command is used to print a file

Select an option to see the answer and solution.

Which of the following signal cannot be handled or ignored?

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;
    s_id = shm_open("shared_mem",O_CREAT|O_RDWR,0666);
    printf("%d\n",s_id);
    if(shm_unlink("shared_mem") == -1)
        perror("shm_unlink");
    return 0;
}

Select an option to see the answer and solution.

/bin/dmesg picks the messages from

Select an option to see the answer and solution.

Which one of the following is bitwise 'exclusive or' operator?

Select an option to see the answer and solution.

For a shared library, version number is changed when

Select an option to see the answer and solution.