Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

Linux MCQ Set 1

1. Which one of the following command creates the executable file a.out?
a) gcc -o aidlo.c
b) gcc aidlo.c
c) gcc -o a.out
d) gcc a.out

View Answer

Answer: b [Reason:] None.

2. If we compile the sanfoudry.c file with the command “gcc -o aidlo aidlo.c”, then the executable file will be
a) a.out
b) aidlo
c) aidlo.out
d) none of the mentioned

View Answer

Answer: b [Reason:] None.

3. If we compile the aidlo.c file with the command “gcc -c aidlo.c”, then the output file will be
a) aidlo.o
b) aidlo.s
c) aidlo.i
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

4. Which gcc option includes debugging info in the generated object code?
a) -g
b) -c
c) -p
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

5. The command “gcc -S aidlo.c” will
a) stop compilation process after the generation of assembly code file
b) generate aidlo.s file
c) stop compilation process after the generation of assembly code file & generate aidlo.s file
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

6. Which gcc option stops compilation process after preprocessing stage?
a) -e
b) -f
c) -E
d) -F

View Answer

Answer: c [Reason:] None.

7. The -v option of gcc
a) print the commands executed to run the stages of compilation
b) version of the gcc compiler
c) all of the mentioned
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

8. Which gcc option turns off certain features of gcc that are incompatible with ISO C89?
a) -ansi
b) -ISO
c) -ver
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

9. The option -fsyntax-only of gcc
a) checks the code for syntax error
b) checks the code for fatal error
c) checks the code for syntax & fatal error
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

10. Which option of gcc inhibit all warning messages?
a) -w
b) -x
c) -y
d) -z

View Answer

Answer: a [Reason:] None.

Linux MCQ Set 2

1. What is the job of -Werror option in gcc?
a) it avoids all the errors present in the source code
b) it makes all warnings into errors
c) it stores all the errors of source code into a seperate file
d) none of the mentioned

View Answer

Answer: b [Reason:] None.

2. The command “as -o aidlo.o aidlo.s” will
a) generate object file aidlo.o
b) provide an error if aidlo.s exists
c) generate object file aidlo.o & provide an error if aidlo.s exists
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

3. The command “gcc -save-temps aidlo.c” will generate
a) aidlo.i
b) aidlo.s
c) aidlo.o
d) all of the mentioned

View Answer

Answer: d [Reason:] None.

4. The -H option of gcc
a) prints the name of each header file used
b) is used to include header file
c) ignores the header file which are not required by source code
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

5. Which option of gcc enables compiler’s all warning messages?
a) -Wall
b) -War
c) -Warn
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

6. Which option of gcc adds include directory of header files?
a) -i
b) -I
c) -e
d) -E

View Answer

Answer: b [Reason:] None.

7. The -fPIC option of gcc
a) generates the position independent code of shared libraries
b) opens the source file in readonly mode
c) opens the source file
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

8. The -shared option of gcc generates shared ______ for shared library.
a) object file
b) preprocessed file
c) source file
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

9. Which option of gcc links with a library file?
a) -l
b) -L
c) -link
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

10. Which option of gcc looks in the provided directory for library files?
a) -l
b) -L
c) -link
d) none of the mentioned

View Answer

Answer: b [Reason:] None.

Linux MCQ Set 3

1. The command “cpp aidlo.c > aidlo.i” will
a) create the expanded source code file sanfoudry.i for the source code file aidlo.c
b) append the content of the aidlo.c into aidlo.i
c) give an error
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

2. Which option of gcc makes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes?
a) -p
b) -P
c) -q
d) -Q

View Answer

Answer: d [Reason:] None.

3. The -Wextra option of gcc
a) is same as -w option
b) does not exist
c) enables extra warning messages
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

4. Which gcc option undefines a preprocessor macro?
a) -U
b) -u
c) -undefine
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

5. Pipes are used rather than temporary files for communication between the various stages of compilation in gcc when
a) -pipe option is used
b) -temp option is used
c) –disable -temp option is used
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

6. The gcc option -Wunused warns when a _____ variable is unused aside from its declaration.
a) variable
b) function
c) macro
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

7. Which one of the following is not true?
a) source codes can not be compiled with static libraries in gcc
b) -O is used for optimization in gcc
c) source codes can be compiled
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

8. The command line options of gcc can also be read from a file with
a) @
b) $
c) #
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

9. Which option of the gcc is used to warn is padding is included in structure?
a) -Wpadded
b) -Wpad
c) -Wpadding
d) None of the mentioned

View Answer

Answer: a [Reason:] None.

10. Which gcc option reports the cpu time taken by each subprocess in the compilation sequence?
a) -time
b) -cpu
c) -process
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

Linux MCQ Set 4

1. For debugging with GDB, the file “aidlo” can be created with the command
a) gcc -g -o aidlo aidlo.c
b) gcc -g aidlo.c
c) gdb aidlo
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

2. For debugging with GDB, the compiled program can be run by the command
a) run
b) execute
c) ./<filename>
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

3. In GDB, breakpoints can be set by the command
a) break
b) b
c) both break and b
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

4. GDB stands for
a) GNU debugger
b) General debugging breakpoint
c) General debugger
d) None of the mentioned

View Answer

Answer: a [Reason:] None.

5. GDB can be used for
a) c language
b) c++ language
c) both c and c++ language
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

6. The command “gdb sanfoundy”
a) will start debugging for the file “aidlo” if the file is compiled with -g option with GCC
b) will create executable for debugging
c) will provide all errors present in the file “aidlo”
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

7. In debugging with GDB, break points can be set to
a) any line
b) any function
c) both any line and function
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

8. In GDB debugging, we can proceed to the next breakpoint with command
a) next
b) continue
c) both next and continue
d) none of the mentioned

View Answer

Answer: b [Reason:] None.

9. At the time of debugging with GDB, if we just press ENTER
a) GDB will repeat the same command you just gave it
b) GDB will do nothing
c) GDB will exit
d) None of the mentioned

View Answer

Answer: a [Reason:] None.

10. To print the value of a variable while debugging with GDB, ______ command can be used.
a) printf
b) print
c) show
d) none of the mentioned

View Answer

Answer: b [Reason:] None.

Linux MCQ Set 5

1. Which GDB command prints the value of a variable in hex.
a) print/x
b) print/h
c) print/e
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

2. Which GDB command interrupts the program whenever the value of a variable is modified and prints the value old and new values of the variable?
a) watch
b) show
c) trace
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

3. Which GDB command produces a stack trace of the function calls that lead to a segmentation fault?
a) trace
b) backtrace
c) forwardtrace
d) none of the mentioned

View Answer

Answer: b [Reason:] None.

4. The specific break point can be deleted by _____ command in GDB.
a) delete
b) del
c) remove
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

5. The “step” command of GDB
a) executes the current line of the program
b) stops the next statement to be executed
c) executes the current line of the program & stops the next statement to be executed
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

6. Which GDB command reloads the debugging information?
a) file
b) reload
c) debug
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

7. GDB can be used
a) to find out the memory leakages
b) to get the result of a particular expression in a program
c) to find the reason of segementation fault
d) all of the mentioned

View Answer

Answer: d [Reason:] None.

8. Which GDB command can be used to put a breakpoint at the beginning of the program?
a) b main
b) b start
c) break
d) none of the mentioned

View Answer

Answer: a [Reason:] None.

9. To put the breakpoint at the current line ____ command can be used?
a) b
b) break
c) both b and break
d) none of the mentioned

View Answer

Answer: c [Reason:] None.

10. We can list all the breakpoint in GDB by the command
a) info break
b) break all
c) both info break and break all
d) none of the mentioned

View Answer

Answer: a [Reason:] None.