71
79.8k

100+ Programming for Problem Solving Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) .

51.

What is output of below program?
int main()
{
int i,j;
for(i = 0,j=0;i<5;i++)
{
printf("%d%d--",i,j);
}
return 0;
}

A. 0--01--12--23--34--
B. 00--10--20--30--40--
C. Compilation Error
D. 00--01--02--03--04--
Answer» B. 00--10--20--30--40--
52.

What is output of below program?
int main()
{
int i;
for(i=0; i<5; ++i++)
{
printf("Hello");
}
return 0;
}

A. Hello is printed 5 times
B. Compilation Error
C. Hello is printed 2 times
D. Hello is printed 3 times
Answer» B. Compilation Error
53.

What is output of below program?
int main()
{
for(; ;);
for(; ;);
printf("Hello");
return 0;
}

A. Compilation Error
B. Runtime Error
C. Nothing is printed
D. Hello is printed infinite times
Answer» C. Nothing is printed
54.

What is the output of below program?
int main()
{
for(; ;)
for(; ;)
printf("Hello..");
return 0;
}

A. Compilation Error
B. Runtime Error
C. Hello is printed one time
D. Hello is printed infinite times
Answer» D. Hello is printed infinite times
55.

How many loops are there in C

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

What is the following is invalid header file in C?

A. math.h
B. mathio.h
C. string.h
D. ctype.h
Answer» B. mathio.h
57.

What is storage class for variable A in below code?
int main()
{
int A;
A = 10;
printf("%d", A);
return 0;
}

A. extern
B. auto
C. register
D. static
Answer» B. auto
58.

#include "stdio.h"
int main()
{
int a@ = 10;
printf("%d", a@);
return 0;
}

A. 10
B. 10@
C. @
D. [Error] stray '@' in program
Answer» D. [Error] stray '@' in program
59.

#include "stdio.h"
int main()
{
int a = 10;
printf("%d", a);
int a = 20;
printf("%d",a);
return 0;
}

A. 1020
B. Error: Redeclartion of a
C. 2020
D. 1010
Answer» B. Error: Redeclartion of a
60.

#include "stdio.h"
int a = 20;
int main()
{
int a = 10;
printf("%d", ::a);
return 0;
}

A. 10
B. 20
C. ::20
D. ::10
Answer» B. 20
61.

#include "stdio.h"
int main()
{
int a = 10, b = 20;
if(a=b)
{
printf("Easy");
}
else
{
printf("Hard");
}
return 0;
}

A. Easy
B. Hard
C. EasyHard
D. Error in program
Answer» A. Easy
62.

Which gcc flag is used to enable all Compiler warnings?

A. gcc -W
B. gcc -w
C. gcc -Wall
D. gcc -wall
Answer» C. gcc -Wall
63.

Which gcc flag is used to generate maximum debug information?

A. gcc -g0
B. gcc –g1
C. gcc -g
D. gcc –g3
Answer» D. gcc –g3
64.

Which macro is used to insert assembly code in C program (VC++ compiler)?

A. __asm__
B. _asm_
C. __asm
D. asm
Answer» C. __asm
65.

Which macro is used to insert assembly code in C program (GCC compiler)?

A. __asm__
B. _asm_
C. __asm
D. asm
Answer» A. __asm__
66.

Will compiler produce any compilation error if same header file is included two times?

A. YES
B. NO
C. Option.
D. Option.
Answer» B. NO
67.

What should be the output of below program?
#define # @
@include "stdio.h"
int main()
{
printf("C.com");
return 0;
}

A. C.com
B. Nothing
C. Compilation Error
D. Depends on Complier
Answer» C. Compilation Error
68.

Which one of the following is invalid macro in C programming?

A. #pragma
B. #error
C. #ifndef
D. #elseif
Answer» D. #elseif
69.

What is the extension of output file produced by Preprocessor?

A. .h
B. .exe
C. .i
D. .asm
Answer» C. .i
70.

Set of consecutive memory locations is called as ________.

A. Function
B. Array
C. Loop
D. Pointer
Answer» B. Array
71.

Array can be considered as set of elements stored in consecutive memory locations but having __________.

A. Same Data Type
B. Same Scope
C. None of these
D. Different Data Type
Answer» A. Same Data Type
72.

In Array, There is one to one correspondence between set of ________ and set of values.

A. Indices
B. Variables
C. Constants
D. Memory Locations
Answer» A. Indices
73.

Smallest element of an array is called as _______.

A. Middle Bound
B. Range
C. Upper Bound
D. Lower Bound
Answer» D. Lower Bound
74.

If we have declared an array described below –
int arr[6];
then which of the following array element is considered as last array element ?

A. arr[6]
B. arr[4]
C. arr[0]
D. arr[5]
Answer» D. arr[5]
75.

Array which is having ____ dimensions is called as 2-D array.

A. 3
B. 2
C. 5
D. 4
Answer» B. 2
76.

What is maximum dimension that array can have in c programming?

A. 2
B. 4
C. Theoretically No Limit but practically limit depends on memory
D. 3
Answer» C. Theoretically No Limit but practically limit depends on memory
77.

Array with last element 'n' will always have array size equal to _______.

A. n+1
B. n-1
C. n+n
D. n
Answer» A. n+1
78.

Array is an example of _______ type memory allocation.

A. Compile Time
B. Run Time
C. none
D. all
Answer» A. Compile Time
79.

Array is ______ data type in C Programming language.

A. Custom Data Type
B. Primitive Data Type
C. None of these
D. Derived Data Type
Answer» D. Derived Data Type
80.

A Pointer to a block of memory is considered same as an array.

A. NO
B. YES
C. none
D. all
Answer» B. YES
81.

What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?

A. The element will be set to 0.
B. The compiler would report an error.
C. The array size would appropriately grow.
D. The program may crash if some important data gets overwritten.
Answer» D. The program may crash if some important data gets overwritten.
82.

If you pass an array as an argument to a function, what actually gets passed?

A. Base address of the array
B. Value of elements in array
C. First element of the array
D. Address of the last element of array
Answer» A. Base address of the array
83.

Pointer is special kind of variable which is used to store __________ of the variable.

A. Address
B. Value
C. Variable Name
D. Data Type
Answer» A. Address
84.

Pointer variable is declared using preceding _________ sign.

A. ^
B. *
C. &
D. %
Answer» B. *
85.

Address stored in the pointer variable is of type __________.

A. Integer
B. Array
C. Floating
D. Character
Answer» A. Integer
86.

Consider the 32 bit compiler. We need to store address of integer variable to integer pointer. What will be the size of integer pointer?

A. 10 Bytes
B. 4 Bytes
C. 2 Bytes
D. 6 Bytes
Answer» C. 2 Bytes
87.

In order to fetch the address of the variable we write preceding _________ sign before variable name.

A. Asteriks
B. Percent
C. Comma
D. Ampersand
Answer» D. Ampersand
88.

What is right way to Initialization array?

A. int num[6] = { 2, 4, 12, 5, 45, 5 } ;
B. int n{} = { 2, 4, 12, 5, 45, 5 } ;
C. int n{6} = { 2, 4, 12 } ;
D. int n(6) = { 2, 4 , 12, 5, 45, 5 }
Answer» A. int num[6] = { 2, 4, 12, 5, 45, 5 } ;
89.

What is the right way to access value of structure variable book{ price, page }?

A. printf("%d%d", book.price, book.page);
B. printf("%d%d", price.book, page.book);
C. printf("%d%d", price::book, page::book);
D. printf("%d%d", price -->book, page -->
Answer» A. printf("%d%d", book.price, book.page);
90.

What is true about fputs function

A. write to a file
B. takes two parameters
C. requires a file pointer
D. all of above
Answer» D. all of above
91.

Wild pointer in C

A. if pointer is pointing to a memory location from where variable has been deleted
B. if pointer has not been initialized
C. if pointer has not defined properly
D. if pointer pointing to more than one variable
Answer» B. if pointer has not been initialized
92.

Any type of modification on the parameter inside the function will reflect in actual variable value can be related to..

A. call by value
B. call by reference
C. both of above
D. none of above
Answer» B. call by reference
93.

Size of void pointer is

A. 1 byte
B. 2 byte
C. 3 byte
D. 4 byte
Answer» B. 2 byte
94.

To print a single character in ouptut,which function is used?

A. getchar()
B. gets()
C. putchar()
D. puts()
Answer» C. putchar()
95.

#define t 10
void main()
{
printf("%d",t);
}

A. 10
B. Error:Unfined symbol 't'
C. Error:Improper placement of preprocessor
D. none of the above
Answer» A. 10
96.

Explicit data type conversion is called

A. Type casting
B. conversion
C. separation
D. none
Answer» A. Type casting
97.

which of these is not a valid character constant

A. “A”
B. ‘A’
C. “*”
D. “+”
Answer» A. “A”
98.

If 'a' is the integer which is not statically initialized then what is the value of 'a'?

A. zero
B. garbage
C. none of these
D. One
Answer» B. garbage
99.

C is a ____________________ language

A. Platform independent programming
B. Platform dependent programming
C. Object oriented programming
D. None of the above.
Answer» B. Platform dependent programming
100.

In a function call, _____________ is passed as arguments.

A. variables
B. constants
C. Expressions
D. All the above
Answer» D. All the above

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.