81. What is the output of this program?
#include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
int main()
{
int fd;
fd = socket(AF_UNIX,SOCK_STREAM,0);
printf("%d\n",fd);
return 0;
}
#include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
int main()
{
int fd;
fd = socket(AF_UNIX,SOCK_STREAM,0);
printf("%d\n",fd);
return 0;
}
82. If one of the thread in multithreaded process is blocked on an I/O, which of the following is true?
83. Ctrl-Z key combination
84. In the output of this program, the string "/* Linux */" will be added at the . . . . . . . . of the source file.
#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
int main()
{
int fd;
fd = open("test.c",O_RDWR|O_APPEND);
write(fd,"/* Linux */",11);
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>
int main()
{
int fd;
fd = open("test.c",O_RDWR|O_APPEND);
write(fd,"/* Linux */",11);
return 0;
}
85. What is the return value ($?) of this code:
os = Unix
[$osName = UnixName] && exit 2
[${os}Name = UnixName] && exit 3
os = Unix
[$osName = UnixName] && exit 2
[${os}Name = UnixName] && exit 3
86. What is the output of this program?
#include<stdio.h>
#include<pthread.h>
void *fun_t(void *arg);
void *fun_t(void *arg)
{
printf("%d\n",a);
pthread_exit("Bye");
}
int main()
{
int a;
pthread_t pt;
void *res_t;
a = 10;
if(pthread_create(&pt,NULL,fun_t,NULL) != 0)
perror("pthread_create");
if(pthread_join(pt,&res_t) != 0)
perror("pthread_join");
return 0;
}
#include<stdio.h>
#include<pthread.h>
void *fun_t(void *arg);
void *fun_t(void *arg)
{
printf("%d\n",a);
pthread_exit("Bye");
}
int main()
{
int a;
pthread_t pt;
void *res_t;
a = 10;
if(pthread_create(&pt,NULL,fun_t,NULL) != 0)
perror("pthread_create");
if(pthread_join(pt,&res_t) != 0)
perror("pthread_join");
return 0;
}
87. After running this program, as your press 4, what will be the output of the program?
#!/bin/bash
echo "How many times you want to print 'Example'"
read value
for ((i=0;i<$value;i++))
do
echo "Example";
done
exit 0
#!/bin/bash
echo "How many times you want to print 'Example'"
read value
for ((i=0;i<$value;i++))
do
echo "Example";
done
exit 0
88. Which of the following commands allows definition and assignment of environment variables under bash
89. The directory /proc/[PID]/tasks contains
90. What is the output of this program?
#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd;
char buff[512];
if( mkfifo("/tmp/test_fifo",0666) == -1)
perror("mkfifo");
fd = open("/tmp/test_fifo",O_RDONLY);
read(fd,buff,512);
printf("%s\n",buff);
return 0;
}
#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd;
char buff[512];
if( mkfifo("/tmp/test_fifo",0666) == -1)
perror("mkfifo");
fd = open("/tmp/test_fifo",O_RDONLY);
read(fd,buff,512);
printf("%s\n",buff);
return 0;
}
Read More Section(Linux)
Each Section contains maximum 100 MCQs question on Linux. To get more questions visit other sections.