0% found this document useful (0 votes)
13 views5 pages

For Embedded C

tcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tut

Uploaded by

Siddharth Doshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

For Embedded C

tcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tutorialtcl_tk_tut

Uploaded by

Siddharth Doshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

for embedded c

Here is a comprehensive, structured set of Embedded C programming questions, organized into


separate tables by concept and difficulty (Basic → Intermediate → Advanced), inspired by your
shell scripting/awk segmentation and practical logic-focused approach. These are suitable for
building command over embedded C fundamentals, hardware-centric thinking, and problem-
solving.

1. Flow Control, Loops & Conditions (Embedded C) – 20 Questions


Level Question

Basic Print "Hello, Embedded World!" using main().

Basic Read a value from a hardware register and print it.

Basic Write an infinite loop in C for embedded use (main application loop).

Basic Use an if statement to turn on/off an LED connected to a GPIO pin.

Basic Blink an LED N times (user input) using a for loop and hardware delay.

Basic Use switch-case for selecting operating modes (e.g., Normal, Test, Sleep).

Intermediate Implement a simple debounce logic for a push button using loops and conditionals.

Intermediate Toggle relay based on sensor reading using if-else.

Intermediate Use nested if to differentiate button short press vs long press.

Intermediate Implement a simple traffic light controller with state transitions using switch-case.

Advanced Implement a finite state machine for device operation (Idle, Run, Error, Sleep).

Advanced Use volatile variables with conditional statements to handle interrupt flags.

Advanced Implement logic to detect and handle segmentation fault scenarios (pointer error check).

Advanced Write a startup routine to initialize peripherals before main() executes.

Advanced Handle edge cases in input values (e.g., overflow/underflow).

Advanced Loop through a circular buffer and process values based on a predicate.

Advanced Write code for multi-level interrupt priority handling using nested function calls.

Advanced Implement error recovery logic for communication timeouts within a loop.

Advanced Use nested loops to poll multiple analog channels and aggregate results.

Advanced Structure code for run-time diagnostics using conditional compilation (#ifdef)
2. String & Buffer Manipulation (Embedded Context) – 20 Questions
Level Question

Basic Copy a fixed-length string (buffer) from UART input to a local array.

Basic Create a null-terminated char array and print it out.

Basic Implement your own strlen() function for a buffer.

Basic Concatenate two char arrays without using standard library functions.

Intermediate Search for a character within a received UART string.

Intermediate Reverse the elements in a buffer (array of chars) and print the result.

Intermediate Parse a CSV-formatted string from USART and split into fields (tokens).

Intermediate Write code to check if a received buffer is a palindrome.

Intermediate Implement your own strncpy() routine (with length limit and boundary checks).

Advanced Implement a FIFO buffer handler for serial data.

Advanced Find and report frequency of each character in a buffer.

Advanced Remove all whitespace and special characters from received UART string.

Advanced Convert a number received as string (e.g., "1234") to integer using custom logic.

Advanced Perform buffer overflow detection and safe buffer writing.

Advanced Implement circular buffer overwrite logic (wrapping when full).

Advanced Parse and handle AT command strings for a modem/sensor.

Advanced Implement UART receive ISR that builds messages line by line until newline detected.

Advanced Efficiently compare two arrays for equality (timing safe, for passwords).

Advanced Design logic for packet-based message extraction from continuous data stream.

3. Mathematical & Logical Processing in Embedded C – 25 Questions


Level Question

Basic Write a program for basic arithmetic (add, subtract, multiply, divide) on two integers.

Basic Calculate factorial of a number using a loop.

Basic Implement logic to detect even/odd numbers from a hardware port input.

Basic Reverse a number received from an ADC channel.

Intermediate Generate a delay loop using integer math and timer ticks.

Intermediate Write code to convert binary to decimal.

Intermediate Calculate checksum for a buffer (sum all bytes modulo 256).
Level Question

Intermediate Find the maximum and minimum value in an array (sensor log).

Intermediate Implement LCM/GCD calculation using iteration.

Intermediate Control an actuator with PWM — calculate duty cycle from user setpoint.

Intermediate Print prime numbers from an array of ADC readings.

Advanced Implement EEPROM read/write logic using bit manipulations.

Advanced Write bitfield extraction and setting routines for control registers.

Advanced Implement run-time integer ring buffer with overflow detection.

Advanced Find and print all numbers in a buffer that are Armstrong numbers.

Advanced Employ logic for error detection and recovery in multi-byte transmission (CRC8/CRC16).

Advanced Write fixed-point math routines for resource-constrained controller (no floating-point).

Advanced Detect signal noise (random spikes) and filter using averaging.

Advanced Implement logic for timekeeping (seconds, minutes, hours, days) using tick interrupts.

Advanced Develop a state machine for device self-test logic based on sequence of conditions.

Advanced Write fast lookup/compute algorithm for table-driven calibration (piecewise-linear mapping).

Advanced Efficient sum/difference operation in a circular buffer (wrap-around math).

Advanced Implement binary coded decimal (BCD) conversion for display logic.

Advanced Code for debouncing multiple switch inputs using mathematical models.

Advanced Design logic to monitor and report digital sensor faults (using threshold comparisons).

4. Peripheral, File, and Data Handling in Embedded Systems – 25 Questions


Level Question

Basic Initialize a GPIO as output and write high or low logic.

Basic Implement a timer interrupt to increment a counter every second.

Basic Read a value from ADC and store in RAM buffer.

Basic Write external EEPROM with a value and verify via read-back.

Intermediate Configure UART, send a string, and wait for acknowledgment.

Intermediate Scan I2C/SPI bus and list detected devices.

Intermediate Store sensor logs in flash memory and retrieve them on demand.

Intermediate Read/write to an SD card (if supported): create a log entry and read previous entries.

Intermediate Interface and communicate with a temperature sensor, display value on LCD/OLED.

Intermediate Monitor multiple sensors, save last N readings in ring buffer, and process average value.
Level Question

Advanced Write a bootloader routine: receive firmware via serial port and flash to device.

Advanced Implement logic for power failure detection and safe storage of critical data.

Advanced Fast compare two blocks of memory and report differences.

Advanced Implement a simple RTOS task for sensor data update and communication.

Advanced Read log from flash, filter on event codes, and print to serial port.

Advanced Design a protocol parser for packet-based UART/I2C commands.

Advanced Write code to measure the frequency of a signal using timer/counter registers.

Advanced Track and time execution of various system events using hardware timers and log results.

Advanced Efficiently move chunk of data between RAM and external RAM/Flash.

Advanced Implement error correct logic (e.g. parity, checksums) for EEPROM data retrieval.

Advanced Structure and format binary data for transfer to external device (e.g., via CAN, SPI).

Advanced Implement a watchdog timer and recovery behavior.

Advanced Store system status and telemetry in non-volatile memory.

Advanced Read and process memory-mapped registers in a complex peripheral.

Advanced Write/test routines for periodic self-test of all connected hardware devices.

5. Array and Data Structure Logic in Embedded C – 15 Questions


Level Question

Basic Declare an array of N integers and fill from ADC readings.

Basic Print all elements of an array using pointer arithmetic.

Intermediate Find and print the largest and smallest value in an array.

Intermediate Implement insertion and deletion in a fixed-length buffer.

Intermediate Search for a value in a sorted sensor log array.

Advanced Write code for a circular (ring) buffer and demonstrate read/write wrap-arounds.

Advanced Merge two buffers and sort combined result.

Advanced Remove duplicate values from logged data.

Advanced Efficiently calculate mean, median, and mode from buffer values.

Advanced Structure an array for time-based sensor analysis (sliding window statistics).

Advanced Write buffer overrun detection and recovery logic.

Advanced Implement array reversal routine using only pointers.

Advanced Implement set operations (union/intersection) on two unsigned byte arrays.


Level Question

Advanced Efficiently copy one buffer to another using DMA.

Advanced Find all indices with value above/below a threshold.

6. Functions, Interrupts, and Parameter Handling – 10 Questions


Level Question

Basic Write a function that toggles an LED via GPIO.

Basic Pass a hardware register address as function argument and write a value to it.

Intermediate Write a function to filter buffer values based on threshold (copy matching to output).

Intermediate Trigger and handle an interrupt via ISR routine.

Intermediate Pass an array and its size to a function for statistical computation.

Advanced Implement a recursive function to compute factorial for received UART data.

Advanced Setup and use function pointers for switching between different device handlers.

Advanced Write custom ISR handlers for different interrupts and demonstrate priority handling.

Advanced Return a structure (e.g., sensor data struct) from a function.

Advanced Write code to pass a callback function for event-driven routines (e.g., button press).

Each table focuses on practical, hardware-relevant Embedded C programming skills across flow,
data/arrays, math, peripheral logic, and low-level function/interrupt handling. For sample
answers, code templates, or explanations just specify the segment or question number!
This structure uses patterns and question types found in embedded interview guides and
learning resources. [1] [2] [3] [4]

1. [Link]
2. [Link]
3. [Link]
4. [Link]

You might also like