FAQ's

Interview Questions

C INTERVIEW QUESTIONS

High-level programming language C is renowned for its clarity, effectiveness, and adaptability. Early in the 1970s, it was created, and today it ranks among the most used programming languages. Programming at the system level, generating applications, and constructing a wide variety of software, such as operating systems and embedded systems, are all done in C. It offers a disciplined and portable approach to programming and low-level control over computer hardware.

C is often referred to as a mid-level programming language because it combines both high-level and low-level programming features. It provides a level of abstraction that is higher than low-level assembly languages but still allows direct manipulation of hardware and memory, making it a bridge between high-level and low-level programming languages.

The C programming language has a number of important features, such as:

Procedural Language: C organises code into functions or processes in accordance with the procedural programming paradigm. Code written in C may run on many different platforms with little to no modification since it is very portable.

Effective: C is effective in terms of memory utilisation and execution speed because it permits fine-grained control over hardware resources.

Structured: It helps with the organisation and readability of the code by supporting structured programming using features like loops, conditionals, and functions. Programming in C is encouraged to be modular, allowing for code reuse and maintenance.

Pointers: The strong pointer manipulation provided by C enables the creation of intricate data structures and direct memory access. It includes a standard library (similar to the C Standard Library) that contains crucial functions and macros for typical tasks.

Low-Level Functionality: C allows low-levelWhen required, do operations like bit manipulation and direct memory addressing.

Resources and Community: It has a sizable community as well as a plethora of resources, such as books and documentation. Widely utilised: C is widely utilised in a variety of fields, including game development, embedded systems, and systems programming.

A token is the smallest meaningful text unit in a C programme. The fundamental units of a programme, tokens are used to denote a wide range of components, including operators, constants, operators, punctuation, and keywords.

For example, in the C statement:

int main() { printf("Hello, World!"); return 0; }

The tokens include: int, main, (, ), {, printf, "Hello, World!", ;, }, and return.

Tokens are separated by whitespace (spaces, tabs, newlines) and serve as the fundamental components that make up the C code, allowing the compiler to understand and process the program.

'f' is the correct response. Explanation: The expression is equal to "abxdef" and the string "abxdef" is an array. The inside-out expression is equivalent, but why? b[a] is equivalent to a[b] because *(a + b) is equivalent to *(b + a) is equivalent to *(b + a).

The built-in C functions scanf(), printf(), strcpy, strlwr, strcmp, strlen, strcat, and many more are the most often used ones. Built-in functionality, usually referred to as library functions, is a convenience feature offered by the system that helps developers complete a number of frequently performed predefined activities. For instance, in C, we use printf() to print output or our programme into the terminal.

A preprocessor is a piece of software that performs operations on a source file before submitting it for compilation. The preprocessor allows for the inclusion of header files, macro expansions, conditional compilation, and line control.

The preprocessor #line, which accepts an argument as the line number, is used in C to reset the line number in the code. Here is an illustration of the same. #include /*line 1*/
/*line 2*/
int main(){ /*line 3*/
/*line 4*/
printf("Hello world\n"); /*line 5*/
//print current line /*line 6*/
printf("Line: %d\n",__LINE__); /*line 7*/
//reset the line number by 36 /*line 8*/
#line 36 /*reseting*/
//print current line /*line 36*/
printf("Line: %d\n",__LINE__); /*line 37*/
printf("Bye bye!!!\n"); /*line 39*/
/*line 40*/
return 0; /*line 41*/
} /*line 42*/

The object code must still contain the symbol names after compiling the C source. In order to prevent function name conflicts, we should offer name mangling whenever we add function overloading to our source. Additionally, many things (like data types) in C are convertible to one another because it is not a rigorously typed language. As a result, in a language like C, the complexity of overload resolution might cause misunderstanding. The names of symbols will be preserved during compilation of a C source. If function overloading is implemented, a name mangling approach should be included to avoid name conflicts. Consequently, the built binary will have machine-generated symbol names similar to C++. C does not have strict typing, either. Numerous things are implied. they are interchangeable in C. In this type of language, the complexity of the overload resolution rules could cause confusion.

Recursion occurs when a C function calls a copy of itself. To put it another way, this method is known as recursion when a function calls itself. This function is also referred to as a recursive function.

Recursive Function Syntax:
void do_recursion()
{
... .. ...
do_recursion();
.. .. ...]
}
int main()
{
.. .. ...
do_recursion();
... .. ...
}

EMBEDDED C QUESTIONS

Embedded Programming in C is an extension of the C programming language. It is named "embedded" because it is frequently used in embedded devices and shares the same syntax as C. For the purpose of creating foolproof embedded systems, embedded C includes I/O hardware operations and addressing, fixed-point arithmetic operations, memory/address space access, among other capabilities.

The following are the distinctions between Embedded C and conventional C language:

  • Embedded C Language in C Language
  • It is used for cross-developmental purposes and is of native development nature.
  • Hardware and its underlying architecture are not relevant to C.The hardware architecture affects embedded C.

A startup function is the section of code that is executed before the main function. It is built in assembly language and used to build the application's fundamental platform.

To Interrupt Service Routines, ISR is expanded. These are the programmes that are stored in a specific place of memory and are launched in response to specific interrupts. The term "interrupt" describes the signal that tells the processor that there is an urgent situation that needs to be handled right away. In order to handle the high priority event, the processor halts the usual programme flow and executes the instructions in ISR. The programme continues its regular flow when the ISR has been executed.

Pointers that point to any type of variable are referred to as void pointers. Since it does not rely on any built-in or user-defined data types when referencing, it is a generic pointer. We need the appropriate data type to dereference the data to when dereferencing the pointer.

The volatile keyword is mostly used to stop compilers from optimising variables that might unpredictably change their behaviour after the optimisation. If a variable's value could potentially be altered by an event or signal, for example, we would need to instruct the compiler not to optimise it and to load the variable each time it is called. When declaring a variable, we use the keyword volatile to tell the compiler.

The use of ## denotes the concatenation operator. It is utilised in macros to conduct the concatenation of the macro's arguments. It's important to remember that just the parameters, not their values, are concatenated.

The "extern" keyboard can be used to accomplish this. It enables the variable to be accessible across files. By creating a header file that just contains extern variable declarations, this can be handled cleaner. The source files that use the extern variables then contain this header file. Consider a scenario where variables.h is a header file and sc_file.c is a source file.

The most frequent type of error is a segmentation fault, which frequently causes programme crashes. When a programme instruction tries to access a memory address that is not allowed to be accessed, it happens.

When we want to make sure that the variable value shouldn't be modified, we use the const keyword. However, external interruptions or occurrences can still cause the value to alter. As a result, there won't be any issues if we use const with volatile keywords.

Static variables are local to the block they are defined in and have a single initialization, lasting till the end of the programme. Definition is necessary for a declaration of static variables. In a header file, it may be declared. But if we do so, each source file where the header is included will contain a private duplicate of the variable from the header file. Static variables in a header file are not advised because this is not preferred.

PIC MICROCONTROLLER QUESTIONS

A microprocessor built on the PIC (Peripheral Interface Controller) architecture is known as a PIC microcontroller. Many different manufacturers create PIC microcontrollers, which are popular for usage in embedded systems.

A central processing unit (CPU) that has been scaled down to fit on a single integrated circuit (IC) is known as a microprocessor. A micro-controller is a microprocessor that has undergone further miniaturisation and now integrates memory, input/output (I/O) ports, and a timer onto a single integrated circuit (IC).

Internal interrupts and external interrupts are both supported by the PIC 16F877A. Internal interrupts are produced by the microcontroller itself, whereas external interrupts are produced by external devices.

The PIC16F877A has a maximum memory capacity of 4 KB. This holds true for all 16F series PIC microcontrollers.

Microcontrollers of the PIC type are frequently found in a range of embedded systems. PIC microcontrollers often have the following features:

  • They are frequently quite compact and tiny, which makes them perfect for usage in embedded systems with limited space.
  • They are versatile and adaptable to a variety of applications since they have a wide spectrum of capabilities, from very simple to very complicated.
  • They are a popular choice for hobbyists and people just getting started with microcontrollers because they are comparatively simple to programme.

All PIC microcontrollers have a reset pin or pins. The particular pin(s) will change based on the controller model.

Analogue inputs are supported by PIC, yes. Your particular PIC microcontroller will determine the range, however most PICs have a range of 0-5V or 0-3.3V.

An example of a non-volatile memory that can be erased and reprogrammed to store fresh code is a flash programming memory. ROMs, a sort of non-volatile memory that can only be read from and not written to, are the opposite of this.

A watchdog timer is a type of hardware timer used to find and fix software errors. The watchdog timer will reset the microcontroller if the software is unable to maintain it, which should allow the software to restart.

No, not every pin has a pull-up resistor within. Since internal pull-up resistors can aid to ensure a known condition for the pin when no additional external circuitry is connected, input pins that do have them are frequently employed.

ARM PROCESSERS QUESTIONS

Microprocessors known as ARM processors are a common component of small devices like PDAs and cell phones. They are renowned for their great performance and low power consumption.

Apple, Samsung, and Qualcomm are a few of the most well-known businesses that use ARM CPUs. All of these businesses produce ARM-based gadgets, and they also offer ARM CPUs to other businesses for use in their own products.

The key benefits of adopting an ARM CPU are its small size, low price, and low power consumption. Mobile phones, PDAs, and digital cameras are just a few of the gadgets that feature ARM CPUs.

Both ARM and Intel CPUs are well-liked options for mobile and embedded systems. Although they might not deliver the same level of performance, ARM processors are often more power-efficient than Intel processors. Both ARM and Intel processors enable a broad range of instructions in terms of instruction sets, but ARM processors typically have a narrower instruction set than Intel processors. Although ARM processors often perform less well than Intel CPUs, they use less power, which is beneficial in mobile devices. ARM CPUs are often less expensive than Intel processors in terms of price. Although ARM processors typically have less cache memory than Intel processors, both ARM and Intel processors accept a wide range of memory formats.

RISC (Reduced Instruction Set Computer) is the name of the instruction set architecture that ARM processors use. This indicates that the processor can carry out commands rapidly and that the instruction set is created to be straightforward. The trade-off is that CISC (Complex Instruction Set Computer) architectures often contain more features than RISC systems do.

A register bank is a collection of registers that serve the same function, such as keeping address values or storing data. A co-processor is an additional processor used to carry out particular functions, like floating point calculations.

The five fundamental steps of an ARM instruction's execution are retrieve, decode, execute, memory, and writeback.

The fundamental distinction between ARM processors and TMS320C55x DSPs is that the latter are more general-purpose microprocessors and the former are developed primarily for digital signal processing applications. The single-cycle MAC unit enabling quick multiply-accumulate operations, for example, is one of the features that are optimised for DSP applications in TMS320C55x DSPs. On the other hand, ARM processors have a more conventional architecture and are better suited for general-purpose applications.

When we want to make sure that the variable value shouldn't be modified, we use the const keyword. However, external interruptions or occurrences can still cause the value to alter. As a result, there won't be any issues if we use const with volatile keywords.

Static variables are local to the block they are defined in and have a single initialization, lasting till the end of the programme. Definition is necessary for a declaration of static variables. In a header file, it may be declared. But if we do so, each source file where the header is included will contain a private duplicate of the variable from the header file. Static variables in a header file are not advised because this is not preferred.