Explore topic-wise MCQs in Engineering.

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

551.

Is there any difference in the #define and typedef in the following code?

typedef char * string_t;
#define string_d char *;
string_t s1, s2;
string_d s3, s4;

A. Yes
B. No
Answer» B. No
552.

Are the properties of i, j and x, y in the following program same?

typedef unsigned long int uli; uli i, j; unsigned long int x, y; 

A. Yes
B. No
Answer» B. No
553.

Can I increase the size of statically allocated array?

A. Yes
B. No
Answer» C.
554.

When we dynamically allocate memory is there any way to free memory during run time?

A. Yes
B. No
Answer» B. No
555.

Declare the following statement?
"An array of three pointers to chars".

A. <pre><code class="cpp">char *ptr[3]();</code></pre>
B. <pre><code class="cpp">char *ptr[3];</code></pre>
C. <pre><code class="cpp">char (*ptr[3])();</code></pre>
D. <pre><code class="cpp">char **ptr[3];</code></pre>
Answer» C. <pre><code class="cpp">char (*ptr[3])();</code></pre>
556.

Declare the following statement?
"A pointer to an array of three chars".

A. <pre><code class="cpp">char *ptr[3]();</code></pre>
B. <pre><code class="cpp">char (*ptr)*[3];</code></pre>
C. <pre><code class="cpp">char (*ptr[3])();</code></pre>
D. <pre><code class="cpp">char (*ptr)[3];</code></pre>
Answer» E.
557.

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» C. string.h
558.

What function should be used to free the memory allocated by calloc() ?

A. dealloc();
B. malloc(variable_name, 0)
C. free();
D. memalloc(variable_name, 0)
Answer» D. memalloc(variable_name, 0)
559.

How will you free the memory allocated by the following program?

#include<stdio.h>
#include<stdlib.h>
#define MAXROW 3
#define MAXCOL 4 int main()
{ int **p, i, j; p = (int **) malloc(MAXROW * sizeof(int*)); return 0;
}

A. memfree(int p);
B. dealloc(p);
C. malloc(p, 0);
D. free(p);
Answer» E.
560.

What is x in the following program?

#include<stdio.h> int main()
{ typedef char (*(*arrfptr[3])())[10]; arrfptr x; return 0;
}

A. x is a pointer
B. x is an array of three pointer
C. x is an array of three function pointers
D. Error in x declaration
Answer» D. Error in x declaration
561.

In the following code what is 'P'?

typedef char *charp;
const charp P;

A. P is a constant
B. P is a character constant
C. P is character type
D. None of above
Answer» B. P is a character constant
562.

In the following code, the P2 is Integer Pointer or Integer?

typedef int *ptr; ptr p1, p2; 

A. Integer
B. Integer pointer
C. Error in declaration
D. None of above
Answer» C. Error in declaration
563.

Declare the following statement?
"A pointer to a function which receives an int pointer and returns float pointer".

A. <pre><code class="cpp">float *(ptr)*int;</code></pre>
B. <pre><code class="cpp">float *(*ptr)(int)</code></pre>
C. <pre><code class="cpp">float *(*ptr)(int*)</code></pre>
D. <pre><code class="cpp">float (*ptr)(int)</code></pre>
Answer» D. <pre><code class="cpp">float (*ptr)(int)</code></pre>
564.

Declare the following statement?
"A pointer to a function which receives nothing and returns nothing".

A. <pre><code class="cpp">void *(ptr)*int;</code></pre>
B. <pre><code class="cpp">void *(*ptr)()</code></pre>
C. <pre><code class="cpp">void *(*ptr)(*)</code></pre>
D. <pre><code class="cpp">void (*ptr)()</code></pre>
Answer» E.