MCQs of C

25
MCQs of C Solved MCQ of C set-1 1. C language has been developed by A) Martin Richards B) Bijarne Stroustrup C) Dennis Ritche D) Ken Thompson 2. int[ ] ={5,6,7,8,9} What is the value of a[3]? A) 9 B) 8 C) 7 D) 6 3. C can be used on A) Only MS-Dos operating System B) Only Linux operating system C) Only Windows operating system D) All of the above 4. Float a[15], what is the size of array? A) 17 B) 14 C) 15 D) 16 5. C programs are converted into machine language with the help of A) An Editor B) A complier C) An operating system D) None of the above

Transcript of MCQs of C

MCQs of CSolved MCQ of C set-1

1. C language has been developed byA) Martin RichardsB) Bijarne Stroustrup C) Dennis RitcheD) Ken Thompson

2. int[ ] ={5,6,7,8,9} What is the value of a[3]?A) 9B) 8C) 7D) 6

3. C can be used on A) Only MS-Dos operating SystemB) Only Linux operating systemC) Only Windows operating systemD) All of the above

4. Float a[15], what is the size of array?A) 17B) 14C) 15D) 16

5. C programs are converted into machine language with the help of A) An EditorB) A complierC) An operating systemD) None of the above

6. Array is A) Primary data typeB) Pointer data typeC) Heterogeneous data typeD) Homogenous data type

7. Which of the following is allowed in a C Arithmetic Instruction?A) [ ]B) { }C) ( )D) None of the above

8. To accept 100 different values into the array we require A) LoopB) If conditionC) FunctionD) Structure

9. If a is an integer variable, a=7/3; will return a valueA) 2.5B) 3C) 0D) 2

10. Pointer holdsA) Value of variableB) Address of variableC) Value and address of variableD) Always null

Answers:1. C) Dennis Ritche2. B) 83. D) All of the above4. C) 155. B) A complier6. D) Homogenous data type7. C) ( )8. A) Loop9. D) 210. B) Address of variable

Objective Questions of C with answer set-2

1. Hierarchy decides which operatorA) is most importantB) is used firstC) is fastestD) Operates on largest numbers

2. A pointer can holdA) Single address at a timeB) Two addresses at a timeC) Number of addresses at a timeD) No address3. An integer constant in C must haveA) At least one digitB) At least one decimal pointC) A comma along with digitsD) Digits separated by commas

4. main() { Int a=3, b=2, c*d*e; d=&a; e=&b; c=*d+*e; } Which one of the given answers is correct?A) a=4, c-6B) a=3, c=5C) a=3, c=6D) a=3, c=8

5. In C a variable cannot containA) Blank SpacesB) Decimal PointC) HyphenD) All of the above

6. Assume that variable x resides at memory location 1234, y at 1111 and p at 2222. Int x=1, y=2, *p; p=&x; y=*p;What will be the value of y after execution of above code?A) 2B) 1C) 1234D) 1111

7. Which of the following is FALSE in C?A) Keywords can be used as variable namesB) Variable names can contain a digitC) Variable names do not contain a blank spaceD) Capital letters can be used in variables

8. If an integer occupies 4 bytes and a character occupies 1 byte of memory, each element of the following structure would occupy how many bytes ? struct name { int age; char name[30]; };A) 30B) 32C) 34D) 36

9. The expression x=4+2 % -8 evaluates toA) -6B) 6C) 4D) None of the above

10. A structure brings together a group ofA) items of the same data typeB) related data items and variablesC) integers with user defined namesD) floating points with user defined names

Answers:1. B) is used first2. A) Single address at a time3. A) At least one digit4. B) a=3, c=55. A) Blank Spaces6. B) 17. A) Keywords variable names8. C) 349. B) 610. B) related data items and variables

Solved MCQ of Programming in C set-3

Dependency graph for tgmath.h header file in C Programming Language (Photo credit: Wikipedia)

1. C language is available for which of the following operating systems?

A) DOS

B) Windows

C) Unix

D) All of the above

2. Which of the following are tokens in C?

A) Keywords

B) Variables

C) Constraints

D) All of the above

3. C was developed in the year .....................

A) 1970

B) 1972

C) 1976

D) 1980

4. Which escape character can be used to beep from speaker in C?

A) \a

B) \b

C) \m

D) \n

5. Which of the following is a keyword is used for storage class?

A) printf

B) external

C) auto

D) scanf

6. Continue statement is used .............

A) to go to the next iteration in a loop

B) come out of a loop

C) exit and return to the main function

D) restarts iteration from beginning of loop

7. File manipulation functions in C are available in which header file?

A) streams.h

B) stdio.h

C) stdlib.h

D) files.h

8. A compiler ................

A) is a computer program

B) translates a high level language into machine language

C) is a part of software

D) editor

9. Explicit type conversion is known as ....................

A) casting

B) conversion

C) disjunction

D) separation

10. A function popularly used C input function

A) scanf

B) printf

C) getch

D) Char

Answers:

1. C language is available for which of the following operating systems?

D) All of the above

2. Which of the following are tokens in C?

D) All of the above

3. C was developed in the year .....................

A) 1970

4. Which escape character can be used to beep from speaker in C?

B) \b

5. Which of the following is a keyword is used for storage class?

C) auto

6. Continue statement is used .............

A) to go to the next iteration in a loop

7. File manipulation functions in C are available in which header file?

B) stdio.h

8. A compiler ................

B) translates a high level language into machine language

9. Explicit type conversion is known as ....................

A) casting

10. A function popularly used C input function

A) scanf

MCQ on C Programming With Answers set-4

1. 'C' is often called a ....

A) Object oriented language

B) High level language

C) Assembly language

D) Machine level language

2. Each C preprocessor directive begins with ....

A) #

B) include

C) main()

D) {

3. C allows arrays of greater than two dimensions, who will determine this?

A) programmer

B) compiler

C) parameter

D) None of the above

4. The b?c=30;

C) max=a>b?a>c?a:c:b>c?b:c

D) return (a>b)?(a:b)

Answers:

1. Which symbol is used as a statement terminator in C?

D) ;

2. If the size of the array is less than the number of initializes then, ..........

B) generates an error message

3. In C, if you pass an array as an argument to a function, what actually gets passed?

C) Base address of the array

4. How many times the following loop be executed? { .. ch='b'; while (ch>='a' && chb) ? a:b;

C) assigns a value 15 to x

6. What is the output of the following code. int n=0, m=1; do { printf("%d", m); m++; } while (mb?a>c?a:c:b>c?b:c