FPL – I Multiple choice Questions

Assignment No :1

1. How do you see hidden files in your home directory?

A) ls –h

B) ls –la

C) ls –hn

D) ls –R

2. To run date first, and then ls -l, which of the following is correct?

A) date $ ls –l

B) date ; ls –l

C) date - ls –l

D) date > ls -l

3. What default permissions do you need to open a directory

A) RWX

B) W

C) R

D) X

4. The hierarchy of a series of directories branching in a user system starts from

A) \home

B) \root

C) /home

D) /root

5. Which directory contains configuration files that stores system and application setting?

A) /etc

B) /lib

C) /usr

D) /var

6. What command is used to remove files?

A) dm

B) rm

C) delete

D) erase

E) None of the above

7. Which of the following command can you execute to count the number of lines in a file?

A. lc

B. wc - 1

C. cl

D. count

E. None of the above

8. What command is used to list the files chap0l, chap02 and chap04?

A. ls chap*

B. ls chap[124]

C. ls - x chap0[124]

D. ls chap0[124]

E. None of the above

9. What command is used to list contents of directories?

A. tar

B. dir

C. lp

D. ls

E. None of the above

10. Who founded the Linux Kernel?

A. Bill Gates

B. Ben Thomas

C. Richard Stallman

D. Linus Torvalds

E. None of the above

11. What command is used to assign executable permission to all of the files named "report"?

A. chmod ugo + x report

B. chmod u + x report

C. chmod ugo + rw report

D. chmod ugo + r report

E. None of the above

12. What command is used to display the top of the file?

A. grep

B. more

C. head

D. cat

E. None of the above

13. What command can be used to get information about yourself?

A. which

B. pwd

C. i /4

D. who am i

E. None of the above

14. What command is used to halt a Linux system?

A. init 0

B. Shutdown -t

C. Shutdown -g -y0

D. Ctrl+Alt+Del

E. None of the above

15. What command is used to copy a file?

A. tar

B. cpio

C. cp

D. copy

E. None of the above

16. What command is used to terminate a process?

A. kill

B. cancel

C. haltsys

D. shutdown

E. None of the above

Assignment No :2

1.Comments are written using the ______.

a. General English Statements

b. Assembly Language Statements

c. Higher Level Language Statements

d. Block Of Code

2. Comments are ______

a. Executable statements

b. Non executable statements

c. Assignment statements

d. Input/Output statements

3. Consider the following statements:(a) Indentation makes programs more readable and simpler to understand (b) Indentation is compulsory while writing a program. Which of the following option is correct?

a. Only (a) is true

b. Only (b) is true

c. Both (a) and (b) are true

d. Both (a) and (b) are false

4. Diamond shape in flow chart denotes ______.

a. Start b. Decision c. End d. Input - Output task

5. RAM stands for ______

a. Read only memory

b. Random access memory

c. Recently Acquired Memory

d. Read Ahead Memory

6. Algorithm and Flowchart help us to______

a. Know the memory capacity

b. Identify the base of a number system

c. Direct the output to a printer

d. Specify the problem completely and clearly

7. Which of the following is not the part of the computer ?

a. Monitor b. Hard disk c. RAM d. Printer

8. Which of the following language does not allow a programmer to substitute name or symbol for numbers.

a. ASSEMBLY-level b. Machine-level c. High Level Lang. d. 4GL

9. The software tool that is used for linking modules together is called______.

a. Editor b. Linker c. Compiler d. Debugger

10. The language that the computer can understand and execute is called

a. Low-level machine language

b. High-level language

c. Assembly Language

d. None of the above

11. Which of the following is the easiest language to learn and use to write programs?

a. High level language

b. Machine level language

c. Assembly level language

d. Middle level language

12. Which of the following language is predecessor to C Programming Language?

a. A b. B c. C++ d. BCPL

13. The only language understood by any computer is :

a. Machine Language

b. Binary Language

c. C

d. Assembly Language

14. A software utility that helps us to write, change and save programs is known as a

a. Editor b. Loader c. Linker d. Compiler

15. C programs are converted into machine language with the help of

a. An Editor

b. A Compiler

c. An Operating System

d. An interpreter

16. When an ` if..else ` statement is included within an ` if ..else ` statement , it is known as a ______.

a. Next if statement

b. another if statement

c. combined if statement

d. Nested if statement

17. Who invented the C Language?

a. Dennis Ritchie

b. Brian Kernighan and Dennis Ritchie

c. Newton

d. Enstin

18. Which one of the following is not an Arithmetic operator?

a. + b. - c. / d. &

Assignment No :3

1. Which header file is needed for usage of sqrt() function?

a. stdio.h b. conio.h c. math.h d. string.h

2. If i=3 and j=i++, what is the value of j ?

a. 4 b. 3 c. 2 d. none of these

3. Size of float data type is ____ .

a. 2 bytes b. 4 bytes c.8 bytes d. 16 bytes

4. The ______logical operator is true only when both operands evaluate to true.

a. and(&) b. greater than(>) c. less than ( <) d. not (!)

5. In a C expression, how is a logical AND represented?

a. @@ b. || c. AND. d.

6. The increment operation ` n+++ ` increments the value of the variable ` n by____.

a. 2 b. -1 c. 3 d. It is an invalid increment operation

7. What will be value of the variable ` y ` in the following expression when it is given that x=5? Exp. y = ( x > 5 ? 3 : 4 ).

a. 5 b. 3 c. 7 d. 4

8. Header files in C contains

a. Compiler commands

b. Library functions

c. Header information of C programs

d. Operators for files

9. Which of the following expressions uses a unary operator?

a. i+j b. #NAME? c. c++ d. scanf()

10. Pick the odd one out.

a. x=x+1 b. x+=1 c. x++ d. x=+1

11. Find the incorrect condition.

a. x=y b. x<y c. x&y d. x>=y

12. If originally x=0,y=0 and z=1.What is the value of x,y ,and z after executing the following statements?

If (z = y){ y++;z--;} else --x;

a. 0,1,-1 b. -1,0,0 c. 0,1,0 d. -1,0,1

13. If-else statement is used as ______.

a. Decision control structure

b. Conditional statements

c. Repetition of code

d. Both B and C

14. An Ampersand before the name of a variable denotes………………

a. Actual Value b. variable name c. Address d. Data Type

15. In C, which of the following symbol is used as statement terminator?

a. , b. ! c. # d. ;

16. A declaration float a,b; occupies ___ of the memory

a. 8 bytes b. 1 byte c. 16 bytes d. 4 bytes

17. What does ` a ` represents in the C language ?

a. a digit b. a character c. a word d. an integer

18. Which of the following operator has the highest priority?

a. ++ b. % c. + d. ||

19. Which of the following operators works likes ` if... else ` statement?

a. :: b. ?: c. -> d.

20. Most programs do some type of input and/or output. Input is when information is collected from a user and output is information that is displayed to a user. In order to do I/O in a ` C ` program, you must first include which header file?

a. iostream.h b. InputOutput.h c. stdio.h d. string.h

Assignment No :4

1. Which of the following shows the correct priority of arithmetic operators in ` C ` ?

(Priority for leftmost operator is highest and priority for the rightmost operator is lowest. Operators with equal priority are separated with the word ` or `

a. **, * or /, + or - b. **, *, /, +, - c. **, /, *, +, - d. / or *, + or

2. What is the output of the following programe?

#include<stdio.h>

int x=40;

main()

{ int x=20;

printf(\"%d\",x)}}

a. 20 b. 40 c. 60 d. 30

3. Which error will be displayed upon compilation of the following function ?

f(int a , int b)

{

int a;

a=20;

return a; }

a. Missing parentheses in return statement

b. The function should be defined as int f(int a, int b)

c. Multiple declaration for a

d. None of the above.

4. Which of the following is the correct O/P of the following program?

#include<stdio.h>

void main()

{ float a=1.5, b=1.55;

if(a==b)

printf(\"a and b are equal\");

else

printf(\"a and b are not eaqual\"); }

a. a and b are equal b. a and b are not equal c. error in the program

d. none of the above

5. Which of the following is the correct usage of conditional operator?

a. a>b ? c=30;c=40; b. a>b ? c=30;

c. max?= a>b ? a>c?a:c:b?b:c; d. return(a>b ? a>c);

6. What would the following code snippet print?

int i=4.23;

printf("%d",i);

a. 4.23 b. 4 c. NAN d. nothing, the program will abort

7. What will be the output of the following code?

main()

{ int x=11,y=6,p,q;

p=x>10; q=x>9 & y != 4;

printf("p=%d q=%d",p,q); }

a. p=1 q=1 b. p=11 q=9 c. p=1 q= 0 d. None

8. Which classes of the data types are supported by C?

a. primary data types b. derived data types c. User-defined data types

d. All the above

9. The operator ` < ` is an example for a ____operator.

a. Logical b. Bitwise c. Arithmetic d. Assignment

10. The conversion specification %c is used

a. to print a single character b. to print more than one character

c. to print whole string d. None of these

11. What is the difference between two statements shown below?

int num[10];

num[10]=11;

a. first is particular element, second is type

b. first is array size, second is particular element

c. first is particular element, second is array size d. both specify array size

12. The ASCII value range for the alphabets from A to Z is

a. 48 to 57 b. 65 to 90 c. 97 to 122 d. None of these

13. What is the output of the following code?

#include<stdio.h>

void main()

{ int s=0;

while(s++<10)

{ if(s<4 & s<9)

continue;

printf("\n%d\t",s); } }

a. 1 2 3 4 5 6 7 8 9 b. 1 2 3 10 c. 4 5 6 7 8 9 10 d. 4 5 6 7 8 9

14. If x=2945, what is the value of the expression ( x/100) % 10

a. 9 b. 2 c. 29 d. 295

15. main()

{ int x=2,y=3,z;

z=--x+y++; } What will be value of the variable ` z ` upon execution of above

code?

a. 2 b. 6 c. 4 d. 5

16. What will be the output of the following code ?

main()

{ int x;

x=3+4-7*8/5%10;

printf(\"x=%d\",x); }

a. 12 b. 6 c. 16 d. 81

Assignment No :5

1. Which of the following is not a Data Type

a. CHAR b. Float c. Int d. Logical.

2. Which one of the following is the correct syntax for printing the float variable named a

to the console?

a. printf("%f",a);

b. printf(\'%f\',a);

c. printf(\"%f\",&a);

d. printf(\"%f\",a&)

3. Any variable in C starts with a ______

a. Number b. Keyword c. Alphabet d. None of the above

4. The correct meaning of the expression a+=4 is _____ .

a. a=a+4 b. a+4=a c. a=4 d. a=4+4

5. The following is a correct way of representing a variable in C?

a. int 0ram; b. float _calculate; c. int if; d. int run#fast;

6. Any C Language program executes the following function when it starts the execution

a. START() b. Start () c. BEGIN () d. main ()

7. Which of the following shows the correct hierarchy of arithmetic operators in ` C ` ?

a. **, * or /, + or – b. **, *, /, +, - c. **, /, *, +, - d. / or *, + or –

8. Which of the following is the format specifier for long signed int ?

a. %d b. %u c. %ld d. %lu

9...... is standard output function

a. printf b. scanf c. getch d. clrscr

10. Which of the following is not a control statement in C?

a. for b. while c. do-while d. else

11. Which of the following is not a comparative operator?

a. >= b. c. == d. *

12. Which of the following is the correct output for the program given below?

main()

{ int x=3;

float y=3.0;

if(x==y)

printf(\"x and y are equal\");

else

printf(\"x and y are not equal\");

}

a. x and y are equal

b. x and y are not equal

c. Unpredictable

d. No output

13. A Program is compiled using a special utility commonly called as a ______

a. Compiler b. Linker c. Assembler d. Loader

14. Which of the following is false statement for ` C ` ?

a. A keyword can be used as a variables name

b. variable names can contain digits

c. variable name do not contain blank space