0

programming languages Online Quiz - 238

Description: programming languages Online Quiz - 238
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

How can I tell how much memory my system has?

  1. Use getmemory()

  2. Use sysctl()

  3. Use freemem()

  4. Use malloc()


Correct Option: B

What is a socket

  1. A port to connect printer

  2. A port to connect keyboard

  3. An abstraction to pass data across processes

  4. A hardware device


Correct Option: C

What is a semaphore

  1. A mechanism to share non-sharable resources

  2. A mechanism to access memory very fast

  3. A mechanism to access kernel details

  4. None


Correct Option: A

What is a message queue?

  1. A printer queue

  2. An IPC mechanism with destructive execute

  3. An IPC mechanism with destructive write

  4. An IPC mechanism with destructive read


Correct Option: D

Difference between shared memory & message queue

  1. No differences

  2. IPC mechanism vs Non-IPC mechanism

  3. Non-destructive read vs destructive read

  4. Destructive read vs non-destructive read


Correct Option: C

To delete the last word of each line in the file test1

  1. sed 's/ */$//' test1

  2. sed 's/ *$//' test1

  3. sed 's/ *$//' test1

  4. sed 's/ *$\/\/' test1


Correct Option: B

How to duplicate file descriptors?

  1. duplicate()

  2. dup()

  3. cp()

  4. mknod()


Correct Option: B

How to set the default shell for an user?

  1. Use chshell command

  2. update the file /var/passwd

  3. update the file /etc/users

  4. update the file /etc/passwd


Correct Option: D

What is the difference between at & cron?

  1. Both are Unix scheduling utilities

  2. at is restricted one and crontab is not restricted

  3. No difference

  4. at takes input from user while cron takes from a confiuration file


Correct Option: D

How to mount a file system temporarily?

  1. mount -t

  2. mount -R

  3. mount

  4. mount -Rt


Correct Option: A

AI Explanation

To mount a file system temporarily, you can use the mount -t command. Let's go through each option to understand why it is correct or incorrect:

A) mount -t - This option is correct because the -t flag is used to specify the file system type. By using this flag followed by the desired file system type, you can mount the file system temporarily.

B) mount -R - This option is incorrect because the -R flag is used to mount a file system read-only, not for temporarily mounting a file system.

C) mount - This option is incorrect because it does not specify the file system type to be mounted. Without specifying the file system type, the command will not be able to successfully mount the file system temporarily.

D) mount -Rt - This option is incorrect because it combines the incorrect options mentioned in options B and C. The -R flag is used for mounting a file system read-only, and the -t flag is used to specify the file system type. Combining them in this way will not result in the desired temporary mounting of a file system.

The correct answer is A) mount -t. This option is correct because it includes the necessary flag to specify the file system type, allowing you to mount the file system temporarily.

How to remove a queued file from the printer queue?

  1. lpqrm

  2. lprm

  3. jobs -r

  4. lpc -rm


Correct Option: B

/etc/fstab cannot be altered when the system is running runlevel 6

  1. True

  2. False


Correct Option: A

fork() and exec() are essentially doing the same job

  1. True

  2. False


Correct Option: B

It is possible to process return value of system()

  1. True

  2. False


Correct Option: A

To execute system() one should have root privilege

  1. True

  2. False


Correct Option: B

lpc command is used to

  1. Add printer and queues

  2. Add modem & flash drive

  3. Add printer alone

  4. Invalid command


Correct Option: A

What is the difference between select() & poll()?

  1. select() and poll() have no differences

  2. poll() is event driven while select() is not

  3. select() is event driven while poll() is not

  4. None


Correct Option: B

What is /proc/kcore process?

  1. The process file name of init

  2. The proc file name of RAM

  3. Invalid file

  4. The core dump file


Correct Option: B

AI Explanation

To answer this question, we need to understand the purpose of the /proc/kcore file in the /proc directory.

Option A) The process file name of init - This option is incorrect. The /proc/kcore file is not related to the process file name of init. The process file name of init is typically /sbin/init or /usr/sbin/init.

Option B) The proc file name of RAM - This option is correct. The /proc/kcore file represents the physical RAM (Random Access Memory) of the system. It is a virtual file that provides a view of the system's memory in a format that can be accessed and examined by user processes.

Option C) Invalid file - This option is incorrect. The /proc/kcore file is a valid file in the /proc directory.

Option D) The core dump file - This option is incorrect. The /proc/kcore file is not the core dump file. A core dump file is typically created when a program terminates abnormally and contains a snapshot of the program's memory at the time of the crash.

The correct answer is B) The proc file name of RAM. This option is correct because the /proc/kcore file represents the physical RAM of the system.

Error in loading shared libraries: lib xxx..so. x: cannot open shared object file: No such file or directory

  1. Resolve by update PATH variable

  2. Resolve by setting SHELLPATH variable

  3. Resolve by updating LD_LIBRARY_PATH

  4. Resolve by setting LIBRARY_PATH variable


Correct Option: C

Setting user id commands related (setuid) are allowed in Liunx and they work as they work with any Unix system

  1. True

  2. False


Correct Option: B
- Hide questions