Hot Topics
Infineon Technologies Solution
Technical Round
- Question 1
Differences between PERL and Python.
- Answer
PERL | Python |
1. Braces are used to mark the statement blocks. | Indentations is used to mark the statements blocks. |
2. To end a statement in Perl we use semi colon. | To end a statement in Python it is not necessary to use semi colon as it widely deals with whitespaces. |
3. Perl focuses on common tasks like report generation and file scanning. | Python focuses on object oriented programming and data structure design. |
- Question 2
CAN protocol
- Answer
The Controller Area Network (CAN) protocol is a communication protocol commonly used in vehicles and industrial control systems.
It was designed to be a robust, multi-master, and fault-tolerant protocol for communication between microcontrollers and devices in a distributed system. The CAN protocol uses a broadcast communication system, where all devices connected to the network receive and process messages, but only the device for which the message is intended will take action.
- Question 3
Are you familiar with C/C++?
- Answer
Tell the language with which you are most comfortable with as the interviewer further might ask you questions from that programming language.
- Question 4
What is an interrupt? What does it do?
- Answer
A signal that is emitted from a device attached to a computer or a program within a computer which temporarily stops or terminates a service or a current process.
- Question 5
Full form of PERL.
- Answer
PERL- Practical Extraction and Report Language.
- Question 6
Write a function to find the max.
- Answer
one possible implementation in Python would be:
def find_max(numbers):
max_value = float('-inf')
for num in numbers:
if num > max_value:
max_value = num
return max_value
- Question 7
Write a Java program to print all the contents of a linked list in one line by not iterating through it again.
- Answer
import java.util.LinkedList;
import java.util.ListIterator;
public class LinkedListExample {
public static void main(String[] args) {
LinkedList<String> list = new LinkedList<>();
list.add("apple");
list.add("banana");
list.add("cherry");
StringBuilder sb = new StringBuilder();
ListIterator<String> iterator = list.listIterator();
while(iterator.hasNext()){
sb.append(iterator.next()+ " ");
}
System.out.println(sb.toString());
}
}
/*
OUTPUT - apple banana cherry
*/
- Question 8
Difference between ‘use'(static module loading) and ‘load'(dynamic module loading) in Perl.
- Answer
In Perl, the ‘use’ keyword is used to load a module at compile-time and execute any code in its package’s import method. This is known as “static module loading” because the module is loaded and its code executed before the program runs.
On the other hand, the ‘load’ function is used to load a module at run-time. This is known as “dynamic module loading” because the module is loaded and its code executed while the program is running.
- Question 9
Write code to find if two given strings are Anagrams?
- Answer
def are_anagrams(string1, string2):
# Create a hash table to count the occurrences of each character
char_count = {}
# Iterate through the characters of the first string
for char in string1:
char_count[char] = char_count.get(char, 0) + 1
# Iterate through the characters of the second string
for char in string2:
if char in char_count:
char_count[char] -= 1
else:
return False
# Check if all counts are zero
for count in char_count.values():
if count != 0:
return False
# If all counts are zero, the strings are anagrams
return True