Q221
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
996
Questions
12/50
Page
Pick an option on a question to see the right answer and solution.
Q221
Open questionSelect an option to see the answer and solution.
Q222
Open question#include<stdio.h>
#include<stdlib.h>
int main()
{
int ret;
int *ptr;
ptr = (int *)malloc(sizeof(int)*10);
free(ptr);
free(ptr);
return 0;
}Select an option to see the answer and solution.
Q223
Open questionSelect an option to see the answer and solution.
Q224
Open question#!/bin/bash
a=1; b=2; c=3
d=$(( ++a**b*c++ + a ))
echo $d
exit 0Select an option to see the answer and solution.
Q225
Open question#! /usr/bin/awk -f
BEGIN {
a=6
do {
print "example"
a++
} while (a<5)
}Select an option to see the answer and solution.
Q226
Open question#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd, count;
char buff[10];
if (mkfifo("/tmp/test_fifo",0666) != 0)
perror("mkfifo");
fd = open("/tmp/test_fifo",O_RDONLY|O_NONBLOCK);
count = read(fd,buff,10);
printf("%d\n",count);
return 0;
}Select an option to see the answer and solution.
Q227
Open questionSelect an option to see the answer and solution.
Q228
Open questionSelect an option to see the answer and solution.
Q229
Open questionSelect an option to see the answer and solution.
Q230
Open question#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 = 1;
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.
Q231
Open question#!/bin/bash
read x
while [ $x != "hello" ]
do
echo "Try to come out of the loop"
read x
done
echo "Welcome"
exit 0Select an option to see the answer and solution.
Q232
Open questionSelect an option to see the answer and solution.
Q233
Open questionSelect an option to see the answer and solution.
Q234
Open question#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
sem_t st;
void *fun_t(void *arg);
void *fun_t(void *arg)
{
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,1,2) != 0)
perror("sem_init");
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.
Q235
Open questionSelect an option to see the answer and solution.
Q236
Open questionSelect an option to see the answer and solution.
Q237
Open questionSelect an option to see the answer and solution.
Q238
Open questionSelect an option to see the answer and solution.
Q239
Open question#!/bin/sh
demo_function() {
echo "Welcome to the Example"
printf "World of Linux\n"
}
unset -f demo_function
demo_function
exit 0Select an option to see the answer and solution.
Q240
Open question#! /usr/bin/awk -f
BEGIN {
print index("examveda","linux")
}Select an option to see the answer and solution.