Explore topic-wise MCQs in Maharashtra CET.

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

1.

In context of C++, consider the following statements:I. Friend function of a class can directly access both private and protected data of the class.II. Member function of derived class can directly access both private and protected data of the class.The true statement(s) is / are:

A. Only I
B. Only II
C. Both I and II
D. Neither I Nor II
Answer» B. Only II
2.

What will be printed when this program is executed?

A. 4 5 6 7
B. 1 2 3 4
C. 4
D. Syntax error
Answer» D. Syntax error
3.

What will be the output of the following program code?

A. 5 5 5 5 5
B. 5 4 3 2 1
C. Infinite Loop
D. Compilation Error
Answer» C. Infinite Loop
4.

What is the result of compiling and running this code?

A. will print Hello World
B. Compilation Error
C. will print garbage value
D. None of these
Answer» C. will print garbage value
5.

What is the output of the program ?

A. 0, 0.000000
B. Garbage values
C. Error
D. None of above
Answer» B. Garbage values
6.

Point out the error in the following program (if it is compiled with Turbo C compiler).

A. No error
B. display() doesn't get invoked
C. display() is called before it is defined
D. None of these
Answer» D. None of these
7.

What will happen after compiling and running following code?

A. Error
B. Will make an infinite loop
C. Some address will be printed
D. None of these
Answer» D. None of these
8.

Comment on the following code?

A. No output on execution
B. Output as 1
C. Output as 2
D. Compile time error
Answer» E.
9.

Guess output of program -

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

What will be the output of the following program ?

A. Run Time Error
B. Compile Time Error
C. 10 20 10 20
D. 10 20 10 garbage
Answer» C. 10 20 10 20
11.

The #else directive is used for

A. Conditionally include source text if the previous #if, #ifdef, #ifndef, or #elif test fails
B. Conditionally include source text if a macro name is not defined
C. Conditionally include source text if a macro name is defined
D. Ending conditional text
Answer» B. Conditionally include source text if a macro name is not defined
12.

Forward declaration is absolutely necessary

A. if a function returns a non-integer quantity
B. lithe function call precedes its definition
C. if the function call precedes its definition and the function returns a non integer quantity
D. none of the above
Answer» D. none of the above
13.

Use of macro instead of function is recommended

A. when one wants to reduce the execution time
B. when there is a loop with a function call inside
C. when a function is called in many places in a program
D. both (a) and (b)
Answer» E.
14.

Can we declare same variable inside the inner and outer block ?

A. Yes, It is possible
B. None of these
C. No , It will give compile error
D. Duplicate Variable is not allowed in C Program
Answer» B. None of these
15.

What is the notation for following functions?1. int f(int a, float b) { /* Some code */ }2. int f(a, b) int a; float b; { /* Some code */ }

A. KR Notation 2. ANSI Notation
B. Pre ANSI C Notation 2. KR Notation
C. ANSI Notation 2. KR Notation
D. ANSI Notation 2. Pre ANSI Notation
Answer» D. ANSI Notation 2. Pre ANSI Notation
16.

Which of the following is not an example of recursion?

A. Towers of Hanoi (TOH)
B. DFS
C. Inorder Tree Traversals
D. SFS
Answer» E.
17.

If the file name is enclosed in angle brackets

A. The preprocessor treats it as a user-defined file
B. The preprocessor treats it as a system-defined file
C. The preprocessor treats it as a user-defined file & system-defined file
D. None of the mentioned
Answer» C. The preprocessor treats it as a user-defined file & system-defined file
18.

Conditional inclusion can be used for

A. Preventing multiple declarations of a variable
B. Check for existence of a variable and doing something if it exists
C. Preventing multiple declarations of same function
D. All of the mentioned
Answer» E.
19.

Automatic variables are allocated memory in

A. heap
B. Data segment
C. Code segment
D. stack
Answer» E.
20.

The function that actually created from a call to a template function is called

A. Generated
B. Inherited
C. Spawned
D. Declassified
Answer» D. Declassified
21.

#include is called

A. Preprocessor directive
B. Inclusion directive
C. File inclusion directive
D. None of the mentioned
Answer» B. Inclusion directive
22.

#include are _______ files and

A. Library, Library
B. Library, user-created header
C. User-created header, library
D. They can include all types of file
Answer» E.
23.

#include statement must be written

A. Before main()
B. Before any scanf/printf
C. After main()
D. It can be written anywhere
Answer» C. After main()
24.

The

A. Tells the preprocessor to grab the text of a file and place it directly into the current file
B. Statements are not typically placed at the top of a program
C. All of the mentioned
D. None of the mentioned
Answer» B. Statements are not typically placed at the top of a program
25.

Which directory the compiler first looks for the file when using

A. Current directory where program is saved
B. C:COMPILERINCLUDE
C. S:SOURCEHEADERS
D. Both C:COMPILERINCLUDE and S:SOURCEHEADERS simultaneously
Answer» C. S:SOURCEHEADERS
26.

What would happen if you create a file stdio.h and use

A. The predefined library file will be selected
B. The user-defined library file will be selected
C. Both the files will be included
D. The compiler won’t accept the program
Answer» C. Both the files will be included
27.

How is search done in

A. When former is used, current directory is searched and when latter is used, standard directory is searched
B. When former is used, predefined directory is searched and when latter is used, current directory is searched and then predefined directories are searched
C. When former is used, search is done in implementation defined manner and latter is used to search current directory
D. For both, search for somelibrary is done in implementation-defined manner
Answer» C. When former is used, search is done in implementation defined manner and latter is used to search current directory
28.

The below two lines are equivalent to #define C_IO_HEADER

A. #include
B. #include”printf”
C. #include”C_IO_HEADER”
D. #include
Answer» B. #include”printf”
29.

Which of the following file extensions are accepted with

A. .h
B. .in
C. .com
D. All of the mentioned
Answer» E.
30.

Which of the following statements are correct about the function?

A. The function calculates the value of 1 raised to power num
B. The function calculates the square root of an integer
C. The function calculates the factorial value of an integer
D. None of above
Answer» D. None of above
31.

How many times the program will print "CompSciBits" ?

A. Infinite times
B. 32767 times
C. 65535 times
D. Till stack overflows
Answer» E.
32.

Which of the following statements are correct about the program?

A. It prints garbage values infinitely
B. Runs infinitely without printing anything
C. Error: main() cannot be called inside printf()
D. No Error and print nothing
Answer» C. Error: main() cannot be called inside printf()
33.

What will be the value retuned by the following function, when it is called with a value 11?

A. Function does not return any value, because it goes into an infinite loop
B. 11
C. 1011
D. None of these
Answer» D. None of these
34.

Point out the error in the program

A. Missing parenthesis in return statement
B. The function should be defined as int f(int a, int b)
C. Redeclaration of a
D. None of above
Answer» D. None of above
35.

There is a error in the below program. Which statement will you add to remove it?

A. Add prototype: float f(aa, bb)
B. Add prototype: float f(int, float)
C. Add prototype: float f(float, int)
D. Add prototype: float f(bb, aa)
Answer» C. Add prototype: float f(float, int)
36.

What error would the following function give on compilation ?

A. Missing parentheses in return statement
B. Function should be define as int f(int a,int b)
C. Redeclaration of a
D. No error
Answer» D. No error
37.

Consider the below function. Let a, b be two non-negative integers. The call find{ a, find(a, b)} can be used to find the

A. maximum of a, b
B. positive difference of a, b
C. sum of a, b
D. minimum of a, b
Answer» E.
38.

Following is a recursive function for computing the sum of integers from 0 to N. The missing line in the else part is

A. Sum:=N+Sum(N)
B. Sum:=N+Sum(N-1)
C. Sum:=(N-1)+Sum(N+1)
D. Sum:=(N-1)+Sum(N-1)
Answer» C. Sum:=(N-1)+Sum(N+1)
39.

What is the meaning of using static before function declaration?

A. Access to static functions is restricted to the file where they are declared
B. Static means nothing, sum() is same without static keyword.
C. Function need not to be declared before its use
D. None of the above
Answer» B. Static means nothing, sum() is same without static keyword.
40.

Which of the following statements are correct about the given program?

A. Prints garbage value infinite times
B. Error
C. Runs infinite times without printing anything
D. None of the above
Answer» D. None of the above
41.

In C, what is the meaning of following function prototype with empty parameter list?

A. Function can only be called without any parameter
B. Function can be called with any number of parameters of any types
C. Function can be called with any number of integer parameters.
D. Function can be called with one integer parameter.
Answer» C. Function can be called with any number of integer parameters.
42.

The following code is an example of

A. Implicit Type Conversion
B. Explicit Type Conversion
C. Error
D. Can not Say
Answer» C. Error
43.

What will be the data type returned for the following function?

A. char
B. int
C. double
D. multiple type-casting in return is illegal
Answer» C. double
44.

What is the output of this code having void return-type function?

A. 1
B. 0
C. Runtime error
D. Compile time error
Answer» E.
45.

Which of the following are an external variable?

A. a
B. b
C. c
D. d
Answer» E.
46.

What is the output of code given below?

A. Compile time error
B. 0
C. Depends on the compiler
D. Depends on the standard
Answer» B. 0
47.

The output of the code below is

A. hello 5 8
B. hello 5
C. hello followed by garbage value
D. Compilation error
Answer» D. Compilation error
48.

Can variable i be accessed by functions in another source file?

A. 0
B. false
C. Only if static keyword is used
D. Depends on the type of the variable
Answer» B. false
49.

What is the output of this C code after linking with source file having definition of ary1?

A. Value of ary1[0]
B. Compile time error due to multiple definition
C. Compile time error because size of array is not provided
D. Compile time error because datatype of array is not provided
Answer» E.
50.

Which part of the program address space is p stored in the code given below?

A. Code/text segment
B. Data segment
C. Bss segment
D. Stack
Answer» D. Stack