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.

451.

Would the following typedef work?
typedef #include l;

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

Will the program compile successfully?

#include<stdio.h> int main()
{ printf("India" "BIX n"); return 0;
}

A. Yes
B. No
Answer» B. No
453.

Will the program compile successfully?

#include<stdio.h>
#define X (4+Y)
#define Y (X+3) int main()
{ printf("%d n", 4*X+2); return 0;
}

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

What will be the output of the program ?

#include<stdio.h> int main()
{ int i=3, *j, k; j = &i; printf("%d n", i**j*i+*j); return 0;
}

A. 30
B. 27
C. 9
D. 3
Answer» B. 27
455.

In the following program add a statement in the function fact() such that the factorial gets stored in j.

#include<stdio.h>
void fact(int*); int main()
{ int i=5; fact(&i); printf("%d n", i); return 0;
}
void fact(int *j)
{ static int s=1; if(*j!=0) { s = s**j; *j = *j-1; fact(j); /* Add a statement here */ }
}

A. j=s;
B. *j=s;
C. *j=&s;
D. &j=s;
Answer» C. *j=&s;
456.

Will the program compile successfully?

#include<stdio.h> int main()
{ #ifdef NOTE int a; a=10; #else int a; a=20; #endif printf("%d n", a); return 0;
}

A. Yes
B. No
Answer» B. No
457.

What will be the output of the program ?

#include<stdio.h> int main()
{ static char *s[] = {"black", "white", "pink", "violet"}; char **ptr[] = {s+3, s+2, s+1, s}, ***p; p = ptr; ++p; printf("%s", **p+1); return 0;
}

A. ink
B. ack
C. ite
D. let
Answer» B. ack
458.

We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind()

A. True
B. False
Answer» B. False
459.

If the different command line arguments are supplied at different times would the output of the following program change?

#include<stdio.h> int main(int argc, char **argv)
{ printf("%d n", argv[argc]); return 0;
}

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

Offset used in fseek() function call can be a negative number.

A. True
B. False
Answer» B. False
461.

In a call to printf() function the format specifier %b can be used to print binary equivalent of an integer.

A. True
B. False
Answer» C.
462.

What will be the output of the program ?

#include<stdio.h> int main()
{ char str[20] = "Hello"; char *const p=str; *p='M'; printf("%s n", str); return 0;
}

A. Mello
B. Hello
C. HMello
D. MHello
Answer» B. Hello
463.

What will be the output of the program If the integer is 4bytes long?

#include<stdio.h> int main() { int ***r, **q, *p, i=8; p = &i; q = &p; r = &q; printf("%d, %d, %d n", *p, **q, ***r); return 0; } 

A. 8, 8, 8
B. 4000, 4002, 4004
C. 4000, 4004, 4008
D. 4000, 4008, 4016
Answer» B. 4000, 4002, 4004
464.

In the following program add a statement in the function fun() such that address of a gets stored in j?

#include<stdio.h>
int main()
{ int *j; void fun(int**); fun(&j); return 0;
}
void fun(int **k)
{ int a=10; /* Add a statement here */
}

A. **k=a;
B. k=&a;
C. *k=&a
D. &k=*a
Answer» D. &k=*a
465.

What will be the output of the program ?

#include<stdio.h>
#include<string.h> int main()
{ printf("%c n", "abcdefgh"[4]); return 0;
}

A. Error
B. d
C. e
D. abcdefgh
Answer» D. abcdefgh
466.

What will be the output of the following program in 16 bit platform assuming that 1022 is memory address of the string "Hello1" (in Turbo C under DOS) ?

#include<stdio.h> int main()
{ printf("%u %s n", &"Hello1", &"Hello2"); return 0;
}

A. 1022 Hello2
B. Hello1 1022
C. Hello1 Hello2
D. 1022 1022
E. Error
Answer» B. Hello1 1022
467.

What will be the output of the program in Turbo C?

#include<stdio.h> int main()
{ char str[10] = "India"; str[6] = "BIX"; printf("%s n", str); return 0;
}

A. India BIX
B. BIX
C. India
D. Error
Answer» E.
468.

What will be the output of the program ?

#include<stdio.h> int main()
{ char t; char *p1 = "India", *p2; p2=p1; p1 = "BIX"; printf("%s %s n", p1, p2); return 0;
}

A. India BIX
B. BIX India
C. India India
D. BIX BIX
Answer» C. India India
469.

What will be the output of the program ?

#include<stdio.h> int main()
{ char str1[] = "Hello"; char str2[] = "Hello"; if(str1 == str2) printf("Equal n"); else printf("Unequal n"); return 0;
}

A. Equal
B. Unequal
C. Error
D. None of above
Answer» C. Error
470.

What will be the output of the program ?

#include<stdio.h> int main()
{ int i; char a[] = " 0"; if(printf("%s", a)) printf("The string is not empty n"); else printf("The string is empty n"); return 0;
}

A. The string is not empty
B. The string is empty
C. No output
D. 0
Answer» C. No output
471.

What will be the output of the program?

#include<stdio.h>
#define MIN(x, y) (x<y)? x : y;
int main()
{ int x=3, y=4, z; z = MIN(x+y/2, y-1); if(z > 0) printf("%d n", z); return 0;
}

A. 3
B. 4
C. 0
D. No output
Answer» B. 4
472.

What will be the output of the program?

#include<stdio.h>
#define MESS junk int main()
{ printf("MESS n"); return 0;
}

A. junk
B. MESS
C. Error
D. Nothing will print
Answer» C. Error
473.

What will be the output of the program?

#include<stdio.h>
#define MAX(a, b, c) (a>b ? a>c ? a : c: b>c ? b : c) int main()
{ int x; x = MAX(3+2, 2+7, 3+7); printf("%d n", x); return 0;
}

A. 5
B. 9
C. 10
D. 3+7
Answer» D. 3+7
474.

What will be the output of the program ?

#include<stdio.h>
#include<string.h> int main()
{ char str1[5], str2[5]; int i; gets(str1); gets(str2); i = strcmp(str1, str2); printf("%d n", i); return 0;
}

A. Unpredictable integer value
B. 0
C. -1
D. Error
Answer» B. 0
475.

What will be the output of the program?

#include<stdio.h>
#define PRINT(i) printf("%d,",i) int main()
{ int x=2, y=3, z=4; PRINT(x); PRINT(y); PRINT(z); return 0;
}

A. 2, 3, 4,
B. 2, 2, 2,
C. 3, 3, 3,
D. 4, 4, 4,
Answer» B. 2, 2, 2,
476.

What will be the output of the program ?

#include<stdio.h> int main()
{ char str[25] = "IndiaBIX"; printf("%s n", &str+2); return 0;
}

A. Garbage value
B. Error
C. No output
D. diaBIX
Answer» B. Error
477.

What will be the output of the program ?

#include<stdio.h> int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; } 

A. Kagpur, Kanpur
B. Nagpur, Kanpur
C. Kagpur, anpur
D. Error
Answer» E.
478.

Can a structure can point to itself?

A. Yes
B. No
Answer» B. No
479.

If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes?

struct ex
{ char ch; int i; long int a;
};

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

What will be the output of the program given below in 16-bit platform ?

#include<stdio.h> int main()
{ enum value{VAL1=0, VAL2, VAL3, VAL4, VAL5} var; printf("%d n", sizeof(var)); return 0;
}

A. 1
B. 2
C. 4
D. 10
Answer» C. 4
481.

It is not possible to create an array of pointer to structures.

A. True
B. False
Answer» C.
482.

What will be the output of the program ?

#include<stdio.h> int main() { enum days {MON=-1, TUE, WED=6, THU, FRI, SAT}; printf("%d, %d, %d, %d, %d, %d n", ++MON, TUE, WED, THU, FRI, SAT); return 0; } 

A. -1, 0, 1, 2, 3, 4
B. Error
C. 0, 1, 6, 3, 4, 5
D. 0, 0, 6, 7, 8, 9
Answer» C. 0, 1, 6, 3, 4, 5
483.

What will be the output of the program ?

#include<stdio.h> int main() { int i=4, j=8; printf("%d, %d, %d n", i|j&j|i, i|j&j|i, i^j); return 0; } 

A. 12, 12, 12
B. 112, 1, 12
C. 32, 1, 12
D. -64, 1, 12
Answer» B. 112, 1, 12
484.

What will be the output of the program in 16-bit platform (under DOS)?

#include<stdio.h> int main()
{ struct node { int data; struct node *link; }; struct node *p, *q; p = (struct node *) malloc(sizeof(struct node)); q = (struct node *) malloc(sizeof(struct node)); printf("%d, %d n", sizeof(p), sizeof(q)); return 0;
}

A. 2, 2
B. 8, 8
C. 5, 5
D. 4, 4
Answer» B. 8, 8
485.

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

/* myprog.c */
#include<stdio.h>
#include<stdlib.h> int main(int argc, char **argv)
{ int i; for(i=1; i<=3; i++) printf("%u n", &argv[i]); return 0;
}

If the first value printed by the above program is 65517, what will be the rest of output?

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

What will be the output of the program ?

#include<stdio.h> int main()
{ struct byte { int one:1; }; struct byte var = {1}; printf("%d n", var.one); return 0;
}

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

Point out the compile time error in the program given below.

#include<stdio.h> int main()
{ int *x; *x=100; return 0;
}

A. Error: invalid assignment for x
B. Error: suspicious pointer conversion
C. No error
D. None of above
Answer» D. None of above
488.

Point out the error in the program

#include<stdio.h> int main()
{ int a[] = {10, 20, 30, 40, 50}; int j; for(j=0; j<5; j++) { printf("%d n", a); a++; } return 0;
}

A. Error: Declaration syntax
B. Error: Expression syntax
C. Error: LValue required
D. Error: Rvalue required
Answer» D. Error: Rvalue required
489.

stderr, stdin, stdout are FILE pointers

A. Yes
B. No
Answer» B. No
490.

A file written in text mode can be read back in binary mode.

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

Is there easy way to print enumeration values symbolically?

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

By default structure variable will be of auto storage class

A. Yes
B. No
Answer» B. No
493.

Is it necessary that the size of all elements in a union should be same?

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

Will the following declaration work?

typedef struct s
{ int a; float b;
}s;

A. Yes
B. No
Answer» B. No
495.

Are the expression *ptr++ and ++*ptr are same?

A. True
B. False
Answer» C.
496.

Will the program compile?

#include<stdio.h>
int main()
{ char str[5] = "IndiaBIX"; return 0;
}

A. True
B. False
Answer» B. False
497.

Are the three declarations char **apple, char *apple[], and char apple[][] same?

A. True
B. False
Answer» C.
498.

Will the following program work?

#include<stdio.h> int main()
{ int n=5; printf("n=%*d n", n, n); return 0;
}

A. Yes
B. No
Answer» B. No
499.

The following program reports an error on compilation.

#include<stdio.h>
int main()
{ float i=10, *j; void *k; k=&i; j=k; printf("%f n", *j); return 0;
}

A. True
B. False
Answer» C.
500.

Is there any difference between the following two statements?
char *p=0;
char *t=NULL;

A. Yes
B. No
Answer» C.