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

25/50

Page

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

Filesystem for CDROM is:

Select an option to see the answer and solution.

One of the entry of /etc/passwd file is shown below:
user1:x:1111:2222:Example:/home/user1:/bin/bash
Which among the following will print userid and home dir in the following pattern “user1:/home/user1”

Select an option to see the answer and solution.

What is the output of the following program?
[ -n $HOME ]
echo $?
[ -z $HOME ]
echo $?

Select an option to see the answer and solution.

The file /proc/devices is the

Select an option to see the answer and solution.

Which of the following is true?

Select an option to see the answer and solution.

For debugging with GDB, the file "example" can be created with the command

Select an option to see the answer and solution.

On x86-32 Linux, at which address the code segment of the program starts?

Select an option to see the answer and solution.

Which one of the following string will print first by this program?
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
 
sem_t st;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
    printf("Linux\n");
    sem_post(&st);
    pthread_exit("Bye"); 
}
int main()
{
    pthread_t pt;
    void *res_t;
    if(pthread_create(&pt,NULL,fun_t,NULL) == -1)
        perror("pthread_create");
    if(sem_init(&st,0,0) != 0)
        perror("sem_init");
    if(sem_wait(&st) != 0)
        perror("sem_wait");
    printf("Example\n");
    if(pthread_join(pt,&res_t) == -1)
        perror("pthread_join");
    if(sem_destroy(&st) != 0)
        perror("sem_destroy");
    return 0;
}

Select an option to see the answer and solution.

Which one can be a real time schedule policy?

Select an option to see the answer and solution.

Most files and directories within /proc are 0 bytes in size because

Select an option to see the answer and solution.

The file /proc/locks displays the file currently locked by the

Select an option to see the answer and solution.

Which is the correct syntax for sed on command line?

Select an option to see the answer and solution.

In this program
#include<stdio.h>
#include<signal.h>
#include<stdlib.h>

int main()
{
    pid_t child;
    child=fork();
    switch(child){
        case -1 :
            perror("fork");
            exit(1);
        case 0 :
            while(1){
                printf("Child Process\n");
                sleep(1);
            }
            break;              
        default :
            sleep(5);
            kill(child,SIGINT);
            printf("The child process has been killed by the parent process\n");
            break;
    }
    return 0;
}

Select an option to see the answer and solution.

Another signal that cannot be caught is:

Select an option to see the answer and solution.

Sysfs internally stores the pointer to the . . . . . . . . that implements the directory in the file system.

Select an option to see the answer and solution.

The major number identifies the . . . . . . . . associated with the device.

Select an option to see the answer and solution.

In this program the two printed memory locations has the difference of . . . . . . . . bytes.
#include<stdio.h>
#include<stdlib.h>
 
int main()
{
    int *ptr;
    ptr = (int*)malloc(sizeof(int)*2);
    printf("%p\n",ptr);
    printf("%p\n",ptr+1);
    return 0;
}

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<sys/time.h>
#include<sys/resource.h>
 
int main()
{
    struct rlimit limit;
    if(getrlimit(RLIMIT_CORE,&limit) != 0)
        perror("getrlimit");
    printf("%lu\n",limit.rlim_max);
    return 0;
}

Select an option to see the answer and solution.

The process of starting up a computer is known as

Select an option to see the answer and solution.

Assemble code of the program can be displayed in GDB by the command

Select an option to see the answer and solution.