Skip to main content

C Basic Quiz 31 August, 2016

1. Which of the following special symbol allowed in a variable name?
A. * (asterisk)
B. | (pipeline)
C. - (hyphen)
D. _ (underscore)

Answer: Option D

2. How would you round off a value from 1.66 to 2.0?
A. ceil(1.66)
B. floor(1.66)
C. roundup(1.66)
D. roundto(1.66)

Answer: Option A

3. Is the following statement a declaration or definition?
extern int i;
A. Declaration
B. Definition
C. Function
D. Error

Answer: Option A

4. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
A. .
B. &
C. *
D. ->

Answer: Option D

5. The operator used to get value at address stored in a pointer variable is
A. *
B. &
C. &&
D. ||

Answer: Option A

6. If the two strings are identical, then strcmp() function returns
A. -1
B. 1
C. 0
D. Yes

Answer: Option C

Explanation:
Declaration: strcmp(const char *s1, const char*s2);
The strcmp return an int value that is
if s1 < s2 returns a value < 0
if s1 == s2 returns 0
if s1 > s2 returns a value > 0

7. Which of the following function is more appropriate for reading in a multi-word string?
A. printf();
B. scanf();
C. gets();
D. puts();

Answer: Option C

Explanation:
gets(); collects a string of characters terminated by a new line from the standard input stream stdin

8. Which header file should be included to use functions like malloc() and calloc()?
A. memory.h
B. stdlib.h
C. string.h
D. dos.h

Answer: Option B

9. Input/output function prototypes and macros are defined in which header file?
A. conio.h
B. stdlib.h
C. stdio.h
D. dos.h

Answer: Option C

10. In C, if you pass an array as an argument to a function, what actually gets passed?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array

Answer: Option C

11. What is the purpose of fflush() function.
A. flushes all streams and specified streams.
B. flushes only specified stream.
C. flushes input/output buffer.
D. flushes file buffer.

Answer: Option A

Explanation:
"fflush()" flush any buffered output associated with filename, which is either a file opened for writing or a shell command for redirecting output to a pipe or coprocess.
Example:
fflush(FilePointer);
fflush(NULL); flushes all streams.

12. Which of the following correctly shows the hierarchy of arithmetic operations in C?
A. / + * -
B. * - / +
C. + - / *
D. / * + -

Answer: Option D

Explanation:
Simply called as BODMAS (Bracket of Division, Multiplication, Addition and Subtraction).

How Do I Remember ? BODMAS !
B - Brackets first
O - Orders (ie Powers and Square Roots, etc.)
DM - Division and Multiplication (left-to-right)
AS - Addition and Subtraction (left-to-right)

13. How will you free the allocated memory ?
A. remove(var-name);
B. free(var-name);
C. delete(var-name);
D. dalloc(var-name);

Answer: Option B

14. What are the different types of real data type in C ?
A. float, double
B. short int, double, long int
C. float, double, long double
D. double, long int, float

Answer: Option C

Explanation:
The floating point data types are called real data types. Hence float, double, and long double are real data types.

15. Which of the following cannot be checked in a switch-case statement?
A. Character
B. Integer
C. Float
D. enum

Answer: Option C

Explanation:
The value of the 'expression' in a switch-case statement must be an integer, char, short, long. Float and double are not allowed.

Congratulations to Epic WarriorsAwesome Blossom & Yogesh is individual winner

Comments

Popular posts from this blog

Debate on Studying grammar is more important than practising conversation skills. July 12, 2016

Favor : Grammar is important than the communication skills because it is the language that makes it possible for us to talk about language. by Grammar you are write names the different of words, and you make sentences, so you can use your grammar skills when you are want communicate, if you Know grammar, your speech will be very obvious, and you will follow by the structure. We all know how to build a sentence, but we do not know how to build a beauty sentence so for this we need to learn by grammar. And knowing about grammar offers a window into the human mind and into our amazingly complex mental capacity. while someone practice grammar become more friendly & he make the maximum output of it. But on conversation he/she may do face some current situation and that time also he/she may not perform perfectly as required. Grammar skilled guy can go anywhere means any type communication - oral or written , face to face or behind, man to man or in a group, personal or corporate w...

Quiz on JAIPUR FACTS July 4, 2016

All are waiting for question. 1. WHO IS FOUNDER OF JAIPUR ANSWER - Jai Singh II 2. The one of the popular sweet dish from Jaipur is the……. ANSWER : Ghewar 3. Ghewar. The sweet is associated with the ……….festival.  Tell me festival name ANSWER : Teej 4. How many windows HAWA-MAHAL has ? ANSWER : 953 5. How many stories HAWAMAHAL has ? ANSWER : 5 6. Birla Mandir is established in which year ANSWER : 1988 7. When Jaipur Metro commercial service started between chandpol and mansarovar , tell me month and year ANSWER : June 2015 Only our team know answer : Subhash Garhwal , Rajeev Jain 8. How much length is covered by Jaipur metro - ANSWER : 9.63KM Our team know this answer : Avanish Kumar 9.  what is the lake name where JAL MAHAL is situated ANSWER : Man Sagar Lake 10. famous food in jaipur ANSWER : dal bati churma Is it question : Subhash Garhwal 11. short Code decided by IRCTC for jaipur ANSWER : JP Explanation : fyi whe...

Game Lemon & Spoon race June 1, 2016

Objective: To hold a spoon in your mouth with a lemon on the spoon and run/walk the distance between the start and finish line. The person that crosses the finish line first is declared the winner. Here are the rules for the lemon & spoon race... Rules: Can only use the lemon and spoon provided to you on race day. Spoon may not be bent or altered in any way. Should hold the spoon in your mouth throughout the race. Hands may not be used to adjust the spoon once the race starts. If the lemon falls off the spoon you will be eliminated. Lemon cannot be altered in any way so as to make it sit right on the spoon. Judges decision is final. I am trying to win : Saurabh Kumar No Saurabh you are wrong : Taruna Yeah, I know but I can hope to win : Sauarbh Hey winner, Please help me : Rajeev Jain Okay : Subhash Garhwal I am trying to do some experiment with lemon : Bhavi Sharma Wow, I am winner : Subhash Garhwal