Filter interviews by
I applied via Naukri.com and was interviewed in Jul 2023. There were 2 interview rounds.
a++ is faster than a=a+1 because it is a single operation compared to two operations in a=a+1.
a++ is a single operation that increments the value of a directly
a=a+1 involves two operations - addition and assignment
Example: int a = 5; int b = a++; // b will be 5, a will be 6
Example: int a = 5; int b = a=a+1; // b will be 6, a will be 6
Pull-up resistors in I2C are used to ensure proper communication by providing a defined voltage level when the bus is in an idle state.
Pull-up resistors are used to pull the signal high when no device is actively driving it low.
They prevent floating bus conditions and help in maintaining signal integrity.
Pull-up resistors are typically connected to the SDA and SCL lines in an I2C bus.
Common values for pull-up resistors...
Use bitwise operations to swap the bytes of the integer without using a second variable.
Use bitwise AND and bitwise OR operations to swap the bytes of the integer.
Shift the bytes to the correct positions using bitwise operations.
Example: a = 0xabcd; a = ((a & 0x00FF) << 8) | ((a & 0xFF00) >> 8);
Compilation steps for C code involve preprocessing, compiling, assembling, and linking.
Preprocessing: Includes header files, macro expansion, and conditional compilation.
Compiling: Translates source code to assembly code specific to the target architecture.
Assembling: Converts assembly code to machine code in object files.
Linking: Combines object files with libraries to create an executable file.
Code bloating refers to the unnecessary increase in the size of software code due to redundant or inefficient programming practices.
Code bloating can occur when developers use inefficient algorithms or write redundant code.
It can also happen when unnecessary features or libraries are included in the codebase.
Code bloating can lead to slower performance, increased memory usage, and longer development times.
Examples of c...
Top trending discussions
posted on 21 Aug 2024
I applied via LinkedIn and was interviewed in Jul 2024. There were 2 interview rounds.
Mutex is used for exclusive access to a resource by a single thread, while semaphore is used for controlling access to a resource by multiple threads.
Mutex is binary in nature, allowing only one thread to access the resource at a time.
Semaphore can have a count greater than 1, allowing multiple threads to access the resource simultaneously.
Mutex is typically used for protecting critical sections of code.
Semaphore is of...
When volatile and const are used together, the variable is treated as read-only and its value can change unexpectedly.
The const keyword indicates that the variable's value cannot be changed by the program.
The volatile keyword tells the compiler that the variable's value may change at any time, even if it doesn't appear to be modified by the program.
When used together, the variable is treated as read-only by the program...
Brute force can be both good and bad depending on the context and application.
Brute force can be effective for small scale problems or when time is limited.
However, it is inefficient and impractical for large scale problems.
Brute force may also be necessary in certain scenarios where no other efficient solution exists.
For example, brute force can be used in password cracking when other methods fail.
Mutex is used for exclusive access to a resource by a single thread, while semaphore is used for controlling access to a resource by multiple threads.
Mutex is binary in nature, allowing only one thread to access the resource at a time.
Semaphore can have a count greater than 1, allowing multiple threads to access the resource simultaneously.
Mutex is used for protecting critical sections of code, while semaphore is used ...
When volatile and const are used together, the variable is treated as read-only and its value can change unexpectedly.
Using volatile and const together is rare but can be useful for memory-mapped hardware registers.
The volatile keyword tells the compiler that the variable can be changed unexpectedly, while const ensures the variable is read-only.
Example: const volatile int * const ptr = (int *)0x1234; // pointer to a r...
Analyst
4
salaries
| ₹1.6 L/yr - ₹6.5 L/yr |
Senior Project Engineer
4
salaries
| ₹6 L/yr - ₹6 L/yr |
Patent Office Delhi
National Informatics Centre
TCS
Infosys