62.
The /sbin/sysctl command is used to

63.
What happnes as the signal SIGINT hits the current process in the program?
#include<stdio.h>
#include<signal.h>
 
void response (int);
void response (int sig_no)
{
    printf("Linux\n");
}
int main()
{
    struct sigaction act;
    act.sa_handler = response;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);
    sigaction(SIGINT,&act,0);
    while(1){
        printf("Example\n");
        sleep(1);
    }
    return 0;
}

65.
This program will print the
#include<stdio.h>
#include<unistd.h>
 
int main()
{
    long int value;
    value = sysconf(_SC_CHILD_MAX);
    printf("%ld\n",value);
    return 0;
}

67.
What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/socket.h>
 
int main()
{
    int fd_server, fd_client, len, len_client;
    struct sockaddr_in add_server;
    fd_server = socket(AF_INET,SOCK_STREAM,0);
    fd_client = accept(fd_server,(struct sockaddr*)&add_server,&len);
    if(fd_client == -1)
        perror("accept");
    if(listen(fd_server,5) != 0)
        perror("listen");
    return 0;
}

69.
What is the output of this program?
#include<stdio.h>
#include<stdlib.h>
 
int main()
{ 
    int *ptr1;
    while(1){
        ptr1 = malloc(1024*1024);
        if(ptr1 == 0)
            break;
        sleep(1);
        printf("Example\n");
        free(ptr1);
    }		
    return 0;
}

70.
What is the output of this program?
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
 
void *fun_t(void *arg);
void *fun_t(void *arg)
{
    pthread_exit("Bye");
}
int main()
{
    pthread_t pt;
    sem_t st;
    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;
}

Read More Section(Linux)

Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.