Embedded C MCQ Banner

Embedded C Multiple Choice Questions (MCQs) and Answers

Master Embedded C with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Embedded C concepts. Begin your placement preparation journey now!

Q31

Q31 A global variable declared with the static keyword is not accessible in another file. Why?

A

Compiler error

B

Limited scope

C

Variable shadowing

D

Incorrect linkage

Q32

Q32 What is the result of the bitwise AND operation 5 & 3?

A

1

B

2

C

3

D

7

Q33

Q33 Which of the following operations sets a particular bit in a number to 1?

A

OR with a mask

B

AND with a mask

C

XOR with a mask

D

NOT with a mask

Q34

Q34 How do you check if the nth bit of a number is set?

A

AND with a mask

B

OR with a mask

C

XOR with a mask

D

NOT operation

Q35

Q35 What does the left shift operator (<<) do in Embedded C?

A

Divides the number

B

Multiplies the number

C

Shifts bits to the right

D

Clears the bits

Q36

Q36 Which bitwise operation is used to toggle (flip) a specific bit in a number?

A

AND

B

OR

C

XOR

D

NOT

Q37

Q37 What happens if a signed integer undergoes a left shift and the most significant bit (MSB) becomes 1?

A

Logical error

B

Overflow

C

MSB is ignored

D

Program crash

Q38

Q38 What will be the output of this code?
int x = 5;
printf("%d", x << 1);

A

5

B

10

C

0

D

15

Q39

Q39 Given the code
int x = 6; x = x & (~(1 << 1));
printf("%d", x);,
what will the output be?

A

2

B

4

C

6

D

0

Q40

Q40 What will the output of the code be?
int x = 9; x = x ^ (1 << 3);
printf("%d", x);

A

1

B

0

C

9

D

1

Q41

Q41 A variable behaves unexpectedly during bitwise operations. What could be a possible cause?

A

Incorrect mask

B

Memory leak

C

Pointer error

D

Clock mismatch

Q42

Q42 A program calculates incorrect values during a left shift operation. What could be the issue?

A

Signed overflow

B

Logical error

C

Clock skew

D

Incorrect data type

Q43

Q43 A bitwise AND operation between two variables gives unexpected results. What is the most likely issue?

A

Uninitialized variable

B

Memory overflow

C

Interrupt error

D

Incorrect loop

Q44

Q44 What does a pointer store in C?

A

Data value

B

Address of another variable

C

Data type

D

Size of variable

Q45

Q45 Which operator is used to dereference a pointer?

A

&

B

*

C

->

D

[]

Q46

Q46 What is a NULL pointer?

A

Pointer pointing to zero address

B

Pointer pointing to garbage

C

Uninitialized pointer

D

Constant pointer

Q47

Q47 Can a pointer to a variable be assigned to a pointer of a different data type?

A

Yes, with casting

B

No

C

Yes, directly

D

Only for integers

Q48

Q48 Which of the following is a valid declaration of a pointer to a function in C?

A

int *func()

B

int (*func)()

C

int &func()

D

int (*func[])()

Q49

Q49 What is the purpose of a double pointer in C?

A

To point to an array

B

To store a pointer to another pointer

C

To allocate memory

D

To access hardware registers

Q50

Q50 What will the output of the following code be?
int x = 10;
int *p = &x;
printf("%d", *p);

A

0

B

10

C

Address of x

D

Error

Q51

Q51 What will the output of this code be?
int arr[] = {1, 2, 3};
int *p = arr;
printf("%d", *(p+1));

A

1

B

2

C

3

D

Error

Q52

Q52 Given
int **pp; int a = 5;
int *p = &a; pp = &p;,
what does **pp represent?

A

Address of a

B

Value of a

C

Value of p

D

Error

Q53

Q53 A pointer is dereferenced, but the program crashes. What could be the most likely cause?

A

NULL pointer

B

Uninitialized variable

C

Memory overflow

D

Infinite loop

Q54

Q54 A pointer to dynamically allocated memory is reassigned without freeing it. What could happen?

A

Memory leak

B

Stack overflow

C

Segmentation fault

D

Incorrect pointer arithmetic

Q55

Q55 A pointer arithmetic operation produces incorrect results. What is the most likely issue?

A

Misaligned pointer

B

Incorrect data type

C

Pointer overflow

D

All of the above

Q56

Q56 What is an interrupt in Embedded C?

A

A delay in the program

B

A function call

C

A signal to the processor

D

A system error

Q57

Q57 Which type of interrupt can be ignored by the processor?

A

Maskable

B

Non-maskable

C

Software

D

Hardware

Q58

Q58 What is the purpose of the Interrupt Service Routine (ISR)?

A

To handle an interrupt

B

To execute the main function

C

To save stack pointers

D

To delay execution

Q59

Q59 What is typically saved by the processor when an interrupt occurs?

A

Only program counter

B

Stack pointer

C

Program counter and CPU state

D

Interrupt vector

Q60

Q60 What is the vector table used for in interrupt handling?

A

To store variables

B

To hold function addresses

C

To define memory

D

To list interrupt addresses

ad verticalad vertical
ad