Explore topic-wise MCQs in Computer Science Engineering (CSE).

This section includes 713 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science Engineering (CSE) knowledge and support exam preparation. Choose a topic below to get started.

1.

The shell acts as an interface between the ..

A. user and kernel
B. user and operating system
C. kernel and operating system
D. none of these
Answer» B. user and operating system
2.

A file x is created with the following contentsecho today is: dateIf you type x.then

A. it echoes the message. followed by date.
B. it gives the desired output only if the execute permission of file x is set.
C. the desired output can be got by the command sh x. which works even if x has its execute permission not set.
D. both (b) and
Answer» E.
3.

Consider the program main ( ){printf("He arose a victor from n"); system ("date") ;printf("the dark domain");}If a.out is the executable code corresponding to the above source code, then the command a.out > out f

A. redirects the output of date to file out f
B. displays the output of date on the screen
C. prints everything on the screen
D. prints the two messages on the screen
Answer» B. displays the output of date on the screen
4.

The following commands gives the output like this #cat file1 file2#cat: file1: No such file or directory helloIf we execute the command cat file1 file2 1>2 2>&1 the output would be

A. cat: file1: no such file or directory hello
B. no output is displayed
C. cat: 1>2: no such file or directory
D. hello
Answer» C. cat: 1>2: no such file or directory
5.

Non leaf node of the file system structure is ..

A. leaf node of file
B. directory of file
C. regular file
D. path name
Answer» C. regular file
6.

Given a code snippet below? #define PERMS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)int main() { int fd1, fd2; umask(0);fd1 = open( file1 , O_CREAT | O_RDWR, PERMS)umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);fd2 = open( file2 , O_CREAT | O_RDWR, PERMS)return 0;}The newly created files file1 and file2 will have the permissions respectively

A. rw-rw-rw- r
B. r rw-rw-rw-
C. rw-rw-rw- rw
D. none of the abov
Answer» D. none of the abov
7.

For the below mentioned codeint main() { int fd;fd = open( logfile , O_CREAT|O_RDWR, 0600);lseek(fd, 5, SEEK_CUR);write(fd, Hello , 5);return 0;},

A. 5
B. 1024
C. 1029
D. 1034
Answer» C. 1029
8.

What is stored in logfile as per below mentioned code if we execute ./a.out > logfile?nt main() {int fd; close(1);fd = open( logfile ,O_RDWR, 0744); write(fd, Hello , 5); printf( World n );return 0;}

A. hello
B. helloworld
C. world
D. none
Answer» C. world
9.

Code snippet (file1 size is 2024)f1 = fopen (file1, RDWR, RWX)lseek(f1,1024,SEEK_SET) write(f1,buf,10)What is offset now.

A. 1024
B. 1034
C. 2034
D. 2054
Answer» C. 2034
10.

The statement z = expr 5 / 2 would store which of the following values in z?

A. 0
B. 1
C. 2
D. 2.5
Answer» D. 2.5
11.

The kernel itself is a program that usually lives in the root partition of the UNIX filesystem. Most Linux distributions call it and it often a symbolic link to the real kernel file which lives in /boot .

A. /vmlinuz
B. /kernel
C. /root
D. none
Answer» B. /kernel
12.

What would be the current working directory at the end of the following command sequence? $ pwd/home/user1/proj$ cd src$ cd generic$ cd .$ pwd

A. /home/user1/proj
B. /home/user1/proj/sr c
C. /home/user1
D. /home/user1/proj /src/generic
Answer» E.
13.

The system start-up scripts are executed by when the system starts up and it is these scripts which are responsible for completing the bootstrap process of the UNIX system.

A. init
B. kernel
C. root
D. none
Answer» B. kernel
14.

System accounting program acctcom find .

A. variable length record
B. fixed length record
C. no record
D. none of these
Answer» C. no record
15.

The read system calls return 0 when ..

A. it reaches middle of file
B. it reaches end of the file
C. file is empty
D. none of these
Answer» C. file is empty
16.

System treats the data in a directory as a ..

A. byte stream
B. bit stream
C. stream
D. none of these
Answer» B. bit stream
17.

Text formatting program troff find . character at the end of each line

A. newline
B. slash
C. dot
D. none of these
Answer» B. slash
18.

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

A. 0 1
B. 1 0
C. 0 0
D. 1 1
Answer» B. 1 0
19.

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

A. 1 1
B. 2 2
C. 0 0
D. 0 1
Answer» D. 0 1
20.

What is the output of the following program? x = 3; y = 5; z = 10;if [( $x -eq 3 ) -a ( $y -eq 5 -o $z -eq 10 )] thenecho $x elseecho $yfi

A. 1
B. 3
C. 5
D. error
Answer» C. 5
21.

Which command is used to remove a file

A. rename
B. mv
C. rm
D. del
Answer» D. del
22.

ode snippets str1= 45678 n str2= 123 n f1 = fopen(file1,RDWR,RWX) f2 = fopen(file1,RDWR,RWX) write(f1,str1,len_str1) write(f2,str2,len_str2)o/p:

A. 12378
B. 123(newline)8(new line)
C. 123(newline)78(ne wline)
D. 45678(newline)1 23(newline)
Answer» C. 123(newline)78(ne wline)
23.

Consider the following program main ( ){ printf ("Aayush won a football match on n"); system ("date");printf("In Berlin"); } if a.out is the executable code corresponding to the above source code,then the command a.out >out f

A. redirects the output of date to a file out f
B. displays the output of date on the screen
C. prints everything on screen
D. prints the two messages on the screen
Answer» B. displays the output of date on the screen
24.

Below is the codeint main() { int fd1, fd2;struct stat buff1, buff2;fd1 = open( 1.txt , O_RDWR); fd2 = open( 2.txt , O_RDWR | O_APPEND);lseek(fd1, 10000, SEEK_SET);write(fd1, abcdefghij , 10);write(fd2, abcdefghij , 10); fstat(fd1, &buff1);fstat(fd2, &buff2);printf( %d %d , buff1.st_size, buff2.st_size);return 0;}Before running the program, the file 1.txt and 2.txt size is 20 each.What is the output?

A. 30 30
B. 100020 20
C. 100030 30
D. 100010 30
Answer» E.
25.

The read system calls return 0 when………..

A. it reaches middle of file
B. it reaches end of the file
C. file is empty
D. none of these
Answer» C. file is empty
26.

here are two hard links to the “file1″ say hl and h2 and a softlink sl. What happens if we deleted the “file1″?

A. we will still be able to access the file with hl and h2 but not with sl
B. we will not be able to access the file with hl and h2 but with sl
C. we will be able to access the file with any of hl, h2 and sl
D. we will not be able to access the file with any of hl, h2 and sl
Answer» B. we will not be able to access the file with hl and h2 but with sl
27.

The internal representation of a file is given by ……..

A. an inode
B. semaphore
C. pipes
D. none
Answer» B. semaphore
28.

Given a code snippet below? #define PERMS (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)int main() { int fd1, fd2; umask(0);fd1 = open(“file1”, O_CREAT | O_RDWR, PERMS)umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);fd2 = open(“file2”, O_CREAT | O_RDWR, PERMS)return 0;}The newly created files file1 and file2 will have the permissions respectively

A. rw-rw-rw- r——–
B. r——– rw-rw-rw-
C. rw-rw-rw- rw——
D. none of the abov
Answer» D. none of the abov
29.

Styles of system start-up scripts…

A. the system v style
B. the bsd style
C. both a and b
D. none
Answer» D. none
30.

A pipe a mechanism that allow a stream of data between to be passed between……..

A. reader and writer process
B. reader process
C. writer process
D. none of these
Answer» B. reader process
31.

f a file is removed in Unix using ‘rm’ then

A. the file can be recovered by a normal user
B. the file cannot be recovered by a user
C. the file can be fully recovered provided the sytem is not rebooted
D. he file will be moved to/lost+found directory and can be recovered only by administrator’s intervention
Answer» C. the file can be fully recovered provided the sytem is not rebooted
32.

If 7 terminals are currently logged on. then the commanddate ; who | wc -l, displays

A. date followed by 7
B. date followed by 8
C. date followed by 1
D. an error message
Answer» B. date followed by 8
33.

You want to have the process/etc/myprocess run when the system enters run level 3. Which of the following inittab entries would accomplish this ?

A. 5:3.once:/etc/myproces s
B. 3:4:once:/etc/mypr ocess
C. once:3:4:/etc/myp rocess
D. once:5:3:/etc/my process
Answer» B. 3:4:once:/etc/mypr ocess
34.

Which command is used to remove a file……

A. rename
B. mv
C. rm
D. del
Answer» D. del
35.

The sort command in UNIX ….

A. used to sort a file
B. used to sort the list of files in a directory
C. both a and b
D. none of the above
Answer» B. used to sort the list of files in a directory
36.

All start-up scripts are typically kept in a directory named which usually lives somewhere under “/etc”

A. init.d
B. init.c
C. intit.e
D. none
Answer» B. init.c
37.

Context switch changes the process mode from………

A. user to kernel mode
B. kernel to user mode
C. kernel mode to the kernel process
D. both (a) and (b)
Answer» E.
38.

You want to install lilo. Which of the following would you do to accomplish this?

A. lilo -u
B. remove lilo
C. uninstall lilo
D. lilo -r
Answer» B. remove lilo
39.

A file x is created with the following contentsecho today is: dateIf you type x.then

A. it echoes the message. followed by date.
B. it gives the desired output only if the execute permission of file x is set.
C. the desired output can be got by the command sh x. which works even if x has its execute permission not set.
D. both (b) and ©
Answer» E.
40.

The command that can be used to restrict incoming messages to a user is………..

A. mesg
B. halt
C. grep
D. sleep
Answer» B. halt
41.

What is stored in logfile as per below mentioned code if we execute ./a.out > logfile?nt main() {int fd; close(1);fd = open(“logfile”,O_RDWR, 0744); write(fd, “Hello”, 5); printf(“World\n”);return 0;}

A. hello
B. helloworld
C. world
D. none
Answer» C. world
42.

Text formatting program troff find…………. character at the end of each line

A. newline
B. slash
C. dot
D. none of these
Answer» B. slash
43.

Full path name starts with …..

A. dot
B. slash
C. double slash
D. non of these
Answer» C. double slash
44.

Two policies for managing memory are……………

A. swaping and demand paging
B. semaphore and deadlock
C. scheduling and wait
D. none
Answer» B. semaphore and deadlock
45.

What is the output of the following code: s=Unixecho 1.$os 2."$os" 3.'$os' 4.$os

A. 1.unix 2.unix 3.unix 4.unix
B. 1.unix 2.unix 3.$os 4.unix
C. 1.unix 2.unix 3.unix 4.$os
D. 1.unix 2.$os 3.$os 4.$os
Answer» C. 1.unix 2.unix 3.unix 4.$os
46.

The new process called, child process gets a ………... return value from fork.

A. -1
B. 0
C. 2
D. 1
Answer» C. 2
47.

signal system call…………

A. control process response to extraordinary events
B. control the size of memory allocated to a process
C. synchronize process execution with exit of previously forked process
D. overlay image of a program onto the running process
Answer» B. control the size of memory allocated to a process
48.

By default, GRUB reads its default boot configuration from………

A. /boot/grub/menu.lst
B. /boot/grub/splash.x pm.gz
C. /boot
D. grub.config
Answer» B. /boot/grub/splash.x pm.gz
49.

To allow only one user to work with a particular file at a particular time ,one has to …..

A. semaphore
B. critical region
C. locking
D. dedicated mode
Answer» D. dedicated mode
50.

What is ‘ps’ command for?

A. prints the status
B. prints the process status
C. prints the execution status
D. none
Answer» C. prints the execution status