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

16/50

Page

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

GDB command "frame" is used

Select an option to see the answer and solution.

What is the difference between the built-in functions rand() and srand() in awk programming?

Select an option to see the answer and solution.

System call can be implemented using which assembly instruction(s) on x86 processors?

Select an option to see the answer and solution.

We can list all the breakpoint in GDB by the command

Select an option to see the answer and solution.

A user does a chmod operation on a file. Which of the following is true?

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");
    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.

This program can send the request to
#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("193.39.0.4");
    len = sizeof(add_server);
    fd  = connect(fd_client,(struct sockaddr*)&add_server,len);
    if(fd == -1)
        perror("connect");
    return 0;
}

Select an option to see the answer and solution.

What will happen if we press "Ctrl+c" key two times after running this program?
#include<stdio.h>
#include<signal.h>
 
void response(int);
void response(int sig_no)
{
    printf("Linux\n");
    signal(SIGINT,SIG_DFL);
}
int main()
{
    signal(SIGINT,response);
    while(1){
        printf("Example\n");
        sleep(1);
    }
    return 0;
}

Select an option to see the answer and solution.

What are the sizes of (Integer/Long/Pointer) in LP64 programming model?

Select an option to see the answer and solution.

Which one of the following is a symlink to the root path as seen by the process?

Select an option to see the answer and solution.

If we compile the example.c file with the command "gcc -c example.c", then the output file will be

Select an option to see the answer and solution.

When mv f1 f2 is executed which file's inode is freed?

Select an option to see the answer and solution.

How to execute ls command inside a vi editor?

Select an option to see the answer and solution.

Unix is which kind of Operating System?

Select an option to see the answer and solution.

Which one of the directory does not contain binary files?

Select an option to see the answer and solution.

If a program is linked against a static library then

Select an option to see the answer and solution.

By default if any regular file is created, the number of link is displayed as 1 ?

Select an option to see the answer and solution.

Which is loaded into memory when system is booted?

Select an option to see the answer and solution.

Which one of the following statement is not true about the format-control letters for printf statement in awk program?

Select an option to see the answer and solution.

What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
 
int main()
{
    int fd, new_fd;
    char *buff;
    buff = (char *)malloc(sizeof(char)*8);
    fd = open("test.c",O_RDONLY);
    new_fd = dup(fd);
    close(fd);
    read(new_fd,buff,8);
    printf("%s\n",buff);
}

Select an option to see the answer and solution.