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

22/50

Page

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

Which tar command option is used to list the files in a tape archive format?

Select an option to see the answer and solution.

A . . . . . . . . is a higher level view of a device that abstracts out low level implementation details/

Select an option to see the answer and solution.

In vi editor, the key combination CTRL+f

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#inlcude<stdlib.h>
 
int main()
{
    int *ptr;
    double *ptr;
    printf("%d\n",sizeof(ptr));
    return 0;	   
}

Select an option to see the answer and solution.

The signal sent to a process when the Ctrl-C key is pressed is

Select an option to see the answer and solution.

BASH shell stands for?

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;
    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");
    if(msgrcv(m_id,&data2,11,0) == -1)
        perror("msgrcv");
    printf("%s\n",data2.buff);
    if(msgctl(m_id,IPC_RMID,0) != 0)
        perror("msgctl");
    return 0;
}

Select an option to see the answer and solution.

What is the output of this progarm?
#include<stdio.h>
#include<unistd.h>
 
int main()
{
    execl("/bin/ls","ls",NULL);
    return 0;
}

Select an option to see the answer and solution.

GDB can be used for

Select an option to see the answer and solution.

In which condition this program will print the string "Example"?
#include<stdio.h>
#include<stdlib.h>
 
int main()
{
    int *ptr;
    ptr = (int *)malloc(sizeof(int)*10);
    if (ptr == NULL)
        printf("Example\n");
    return 0;
}

Select an option to see the answer and solution.

Which one of the following is not true about GDB?

Select an option to see the answer and solution.

In Linux kernel-2.6 Real time priority ranges from

Select an option to see the answer and solution.

What is the function of bind command in bash shell?

Select an option to see the answer and solution.

If the argument is supplied to the exit statement,

Select an option to see the answer and solution.

Which signal is generated when we press control-C?

Select an option to see the answer and solution.

How do you get parent process identification number?

Select an option to see the answer and solution.

printf() uses which system call

Select an option to see the answer and solution.

Sysfs was originally called

Select an option to see the answer and solution.

Which command can be used to test various file attributes

Select an option to see the answer and solution.

What is the output of this pogram?
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/sem.h>
 
static int sem_p(void);
static int sem_v(void);
union semun{
    int val;
    struct semid_ds *buf;
    unsigned short array;
};
int sem_id;
struct semid_ds myds;
struct sembuf mybuf;
union semun myun;
static int sem_p(void)
{
    mybuf.sem_num = 0;
    mybuf.sem_op = -1;
    mybuf.sem_flg = SEM_UNDO;
    semop(sem_id,&mybuf,1);
}
static int sem_v(void)
{
    mybuf.sem_num = 0;
    mybuf.sem_op = 1;
    mybuf.sem_flg = SEM_UNDO;
    semop(sem_id,&mybuf,1);
}
int main()
{
    int wfd, rfd;
    sem_id = semget((key_t)911,1,0666 | IPC_CREAT);
    myun.val = 0;
    semctl(sem_id,0,SETVAL,myun);
    sem_p();
    printf("Example\n");
    sem_v();
    semctl(sem_id,0,IPC_RMID,myun);
    return 0;
}

Select an option to see the answer and solution.