Explore topic-wise MCQs in C Programming.

This section includes 391 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.

51.

A number-arrangement machine, when given an input string of numbers, arranges them following a particular pattern. The following is the illustration of an input and its arrangement.Input:3497611Step I916814936121Step II1220905642132Step III1725956147137Step IV15 23935945135As per the rules followed in the above steps. find the appropriate answerWhich is the fifth number from the left end in step III of the following input?6, 2, 14, 17, 8, 13

A. 77
B. 72
C. 75
D. 7
Answer» B. 72
52.

If ABC × DEED = ABCABC; where A, B, C, D and E are different digits, what are the values of D and E?

A. D = 2, E = 0
B. D = 0, E = 1
C. D = 1, E = 0
D. D = 1, E = 2
Answer» D. D = 1, E = 2
53.

According to the rules followed by above steps, how many steps will be required to reach the final stage of the input given below?Input: ram accessing the office computer through his ID.

A. IV
B. VII
C. VI
D. V
Answer» E.
54.

According to the rules followed in the above steps, how many steps will be required to reach the final stage of the input given below?New Input: 82 hertz 54 flake 34 rancid 94 appeal 18.

A. Step VII
B. Step IV
C. Step VI
D. Step V
Answer» C. Step VI
55.

Which of the following operations can be performed on the file "NOTES.TXT" using the below code?

A. Reading
B. Writing
C. Appending
D. Read and Write
Answer» E.
56.

On executing the below program what will be the contents of 'target.txt' file if the source file contains a line "To err is human"?

A. r n
B. Trh
C. err
D. None of above
Answer» C. err
57.

To print out a and b given below, which of the following printf() statement will you use?

A. printf("%f %lf", a, b);
B. printf("%Lf %f", a, b);
C. printf("%Lf %Lf", a, b);
D. printf("%f %Lf", a, b);
Answer» B. printf("%Lf %f", a, b);
58.

If the file 'source.txt' contains a line "Be my friend" which of the following will be the output of below program?

A. friend
B. frien
C. end
D. Error in fseek();
Answer» D. Error in fseek();
59.

What will be the content of 'file.c' after executing the following program?

A. B
B. A B
C. B B
D. Error in opening file 'file1.c'
Answer» B. A B
60.

Consider the following program and what will be content of t?

A. size of "DUMMY.C" file
B. The handle associated with "DUMMY.C" file
C. Garbage value
D. Error in fileno()
Answer» C. Garbage value
61.

To scan a and b given below, which of the following scanf() statement will you use?

A. scanf("%f %f", &a, &b);
B. scanf("%Lf %Lf", &a, &b);
C. scanf("%f %Lf", &a, &b);
D. scanf("%f %lf", &a, &b);
Answer» E.
62.

What does fp point to in the program ?

A. The first character in the file
B. A structure which contains a char pointer which points to the first character of a file.
C. The name of the file.
D. The last character in the file.
Answer» C. The name of the file.
63.

Comment on the output of following C program?

A. size of a is 4, value of a is 1
B. size of a is 4, value of a is 2
C. size of a is 2, value of a is 2
D. size of a is 2, value of a is 2
Answer» B. size of a is 4, value of a is 2
64.

What will be the size of the following structure?

A. 5
B. 11
C. 41
D. 44
Answer» E.
65.

Comment on the following C code?

A. Output is 8
B. Output is 4
C. Output is 1
D. Error, we can’t use sizeof on macro-definitions
Answer» B. Output is 4
66.

Determine the Final Output:

A. absiha
B. asiha
C. haasi
D. hai
Answer» E.
67.

In the below program everytime program is run different numbers are generated.

A. True
B. False
C. Depends on the platform
D. Depends on the compiler
Answer» C. Depends on the platform
68.

For the following program, Which of the following should be used for freeing the memory allocated?

A. free(p1); free(p1->next)
B. free(p1->next); free(p1);
C. free(p1);
D. all of the mentioned
Answer» C. free(p1);
69.

What will be the output of the program (myprog.c) given below if it is executed from the command line?cmd> myprog friday tuesday sunday

A. r
B. f
C. m
D. y
Answer» B. f
70.

What will be the output of the program

A. 1 2 3
B. 1 2 3 4
C. 2 3 4
D. 1
Answer» C. 2 3 4
71.

What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)?cmd> sample Good Morning

A. 3 Good
B. 2 Good
C. Good Morning
D. 3 Morning
Answer» B. 2 Good
72.

What will be the output of the program if it is executed like below?cmd> sample

A. 0
B. sample
C. samp
D. No output
Answer» C. samp
73.

What will be the output of the program (sample.c) given below if it is executed from the command line?cmd> sample "*.c"

A. *.c
B. "*.c"
C. sample *.c
D. List of all files and folders in the current directory
Answer» B. "*.c"
74.

What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)?cmd> sample 1 2 3

A. 6
B. sample 6
C. Error
D. Garbage value
Answer» D. Garbage value
75.

What will be the output of the program (sample.c) given below if it is executed from the command line?cmd> sample one two three

A. three two one
B. owt
C. eno
D. eerht
Answer» D. eerht
76.

What will be the output of the program (sample.c) given below if it is executed from the command line?cmd> sample friday tuesday sunday

A. s
B. f
C. u
D. r
Answer» D. r
77.

What will be the output of the program (sample.c) given below if it is executed from the command line?cmd> sample 1 2 3cmd> sample 2 2 3cmd> sample 3 2 3

A. sample 3 2 3
B. sample 1 2 3
C. sample
D. Error
Answer» D. Error
78.

What will be the output of the program (myprog.c) given below if it is executed from the command line?cmd> myprog 1 2 3

A. 123
B. 6
C. Error
D. "123"
Answer» C. Error
79.

What will be the output of the program (sample.c) given below if it is executed from the command line?cmd> sample Jan Feb Mar

A. No output
B. sample Jan Feb Mar
C. Jan Feb Mar
D. Error
Answer» D. Error
80.

What will be the output of the program (sample.c) given below if it is executed from the command line?cmd> sample monday tuesday wednesday thursday

A. sample monday tuesday wednesday thursday
B. monday tuesday wednesday thursday
C. monday tuesday thursday
D. tuesday
Answer» C. monday tuesday thursday
81.

What will be the output of the program (myprog.c) given below if it is executed from the command line?cmd> myprog 10 20 30

A. 10 20 30
B. myprog 10 20
C. myprog 10 20 30
D. 10 20
Answer» D. 10 20
82.

If the following program (myproc.c) is present in the directory "C:\TC" then what will be output of the program if run it from DOS shell?

A. SAMPLE.C
B. C:\TC\MYPROC.EXE
C. C:\TC
D. Error
Answer» C. C:\TC
83.

What will be the output of the program if value 25 given to scanf()?

A. 25
B. 2
C. 1
D. 5
Answer» D. 5
84.

Point out the correct statements about the program?

A. The code copies the content of one file to another
B. The code writes strings that are read from the keyboard into a file.
C. The code reads a file
D. None of above
Answer» C. The code reads a file
85.

Which of the following statement is correct about the program?

A. The code writes a text to a file
B. The code reads a text files and display its content in reverse order
C. The code writes a text to a file in reverse order
D. None of above
Answer» C. The code writes a text to a file in reverse order
86.

Point out the error/warning in the program?

A. Error: in unsigned char declaration
B. Error: while statement
C. No error
D. It prints all characters in file "trial"
Answer» B. Error: while statement
87.

What will be the output of the program (myprog.c) given below if it is executed from the command line?cmd> myprog one two three

A. 65525 65531
B. 65519 65521
C. 65517 65517
D. 65521 65525
Answer» C. 65517 65517
88.

Point out the error in the program?

A. Error: unrecognised Keyword SEEK_SET
B. Error: fseek() long offset value
C. No error
D. None of above
Answer» C. No error
89.

gets and puts operate on

A. stdin and stdout
B. files
C. stderr
D. nothing
Answer» B. files
90.

The for statement can precede a loop to be executed 50 times or till a boolean variable "found" become false is given by

A. for(i=0; i<=50 ll found==false; i++)
B. for(i=0; i<50 ll found==true; i++)
C. for(i=1;i<=50 && found==true; i++)
D. Error
Answer» B. for(i=0; i<50 ll found==true; i++)
91.

ungetc is used

A. to get a char
B. to get an int
C. to push a character back to file
D. nothing
Answer» D. nothing
92.

For x and y are variables as declared belowdouble x=0.005,y=-0.01;What is the value of ceil(x+y)

A. 1
B. 0
C. 0.005
D. Error
Answer» B. 0
93.

If following variables are set to the values as shown below, then what is the value of the expression following it?answer=2;marks=10;!((answer2))

A. -1
B. 0
C. -1
D. Error
Answer» C. -1
94.

Expression ((fpt=fopen("Samples","w"))==NULL)would be true if

A. The file sample does not exist while fopen is being executed
B. The file sample could not be created for writing
C. fpt is declared as a FILE pointer
D. The file sample is read only
Answer» C. fpt is declared as a FILE pointer
95.

If n has the value 3, then the output of the statementprintf(  " %d %d " , n++, ++n);

A. is 3 5
B. is 4 5
C. is 4 4
D. is implementation dependent
Answer» E.
96.

Which data type is suitable for storing a number like?10.0000000001

A. int
B. float
C. double
D. both float and double
Answer» D. both float and double
97.

Which is true about isupper(c), where c is an int that can be represented as an unsigned char or EOF.isupper(c) returns?

A. Non-zero if c is upper case
B. 0 if c is not upper case
C. Nothing
D. Both Non-zero if c is upper case & 0 if c is not upper case
Answer» E.
98.

If y is of integer type then the expression  3 * ( y - 8 ) / 9 and  ( y - 8 )/ 9 * 3

A. must yield the same value
B. must yield different values
C. may or may not yield the same value
D. none of these
Answer» D. none of these
99.

calloc() returns a storage that is initialized to

A. Zero
B. Null
C. Nothing
D. One
Answer» B. Null
100.

log(x) function defined in math.h header file is

A. Natural base logarithm
B. Logarithm to the base 2
C. Logarithm to the base 10
D. None of the mentioned
Answer» B. Logarithm to the base 2