英伟达嵌入式软件工程师笔试 9-26
《嵌入式软件开发笔试与面试手册》:https://blog.nowcoder.net/zhuanlan/jvN8gj
《软件开发笔试汇总》:https://blog.nowcoder.net/zhuanlan/0oDWVm
题型:全英文,选择题+编程题(核心代码模式)
1.Permutation Operations
Given a permutation P=[3,7,1,10,9.2,6,5,4,8],one permutation operation is defined as: for each index i (1 <= i <= 10), new_arr[i] = arr[P[i]] and then arr = new_arr.
For a sorted array of 10 distinct integers, how many times must this operation execute to reach the sorted array again?
Note: 1-based index is used.
Pick ONE option
15
30
70
10
2.Inversion Count - 2
Given an array A=[7,9,4,5,6,3,10,7,100]. Find the inversion count of the array. if(i<j).and(A[i] >A[j]), then pair(i ,j ) is called an inversion of an array A. How many inversions are in the array?
Pick ONE option
13
12
14
11
3.Linux Process Tree
The top and ps commands are used in Linux to observe the process information.What are the major points of difference between the two commands?
Pick ONE OR MORE options
The top command is dynamic while ps is static.
The top command is preferred in scripts as it gives a real-time view of the system.
The ps command shows only running processes while the top command shows both running and sleeping processes.
The top command is preferred when you want a repetitive update of the processes while ps is used when you need a snapshot of current processes.
4.Job Scheduling
ln a Linux environment, an adminstrator needs to the schedule a complex job that involves executing a series of commands every Sunday at 2:00 AM. The job has dependencies, requires elevated privileges for certain commands, and the output must be captured in a log file.
Which option is the most suitable approach?
Pick ONE option
1.Create a systemd timer unit.
2.Configure the timer unit to run every Sunday at 2:00 AM.
3. Write a custom script containing the necessary commands and dependencies.
4.Ensure the custom script has appropriate permissions.
5. Direct the output of the custom script to a designated log file.
1.Create a custom script that includes the required commands and their dependencies.
2.Set appropriate permission settings for the custom script.
3.Configure the script to redirect the output to a designated log file.
4.Utilize the at command to schedule the execution of the custom script.
5.Schedule the script to run every Sunday at 2:00 AM using the at command.
1.Create a custom script that includes the required commands and their dependencies.
2.Adjust the permissions within the custom script to ensure proper execution.
3.Set up a crontab entry for the root user.
4.Configure the crontab entry to run every Sunday at 2:00 AM.
5.Modify the custom script to redirect the output to a designated log file.
1.Create a custom systemd target unit.
2.Define the target unit to encompass the job's dependencies and commands.
3.Configure the target unit to trigger every Sunday at 2:00 AM.
4.Ensure appropriate permissions are set within the target unit.
5.lmplement log file handling within the target unit to capture the output.
5. Skip Lists
A skip list is a probabilistic data structure. It is used to stored a sorted list of elements in a linked list. It allows the elements to be processed efficiently. In one single step , it may skip several elements of the entire list, which is why it is known as a skip list.
The skip list is an extended version of the linked list. It allows the user to search, remove, and insert the element very quickly. It consists of a base list that includes a set of elements that maintains the link hierarchy of the subsequent elements.
What is the ratio of time complexity improvement of skip lists from linked lists in insertion and deletion?
Pick ONE option
O(n) to O(log n) where n is the number of elements
O(n) to O(1) where n is the number of elements
No Change
O(n) to O(n^2) where n is the number of elements
6.SQL Statements
Which of the following statement(s) are NOT correct:
Pick ONE OR MORE options
The PRIMARY KEY must be unique and not null for each table.
The DROP command is used to remove the table definition and its contents whereas the TRUNCATE command is used to delete all the rows from the table.
DELETE command is a DDL command whereas DROP is a DML command.
ACID properties in databases refer to Atomicity, Complexity, Isolation, and Duplicacy.
7.Advanced List Comprehensions
Consider the following two lists.
fruits = [ 'apple', 'orange', ' banana ' , 'grape', 'strawberry', 'blueberry' , 'mango']
prices = [1.25,0.75,0.50,2.00,3.50,4.00,1.75]
Use list comprehensions to perform these tasks:
Create a new list called fruit_prices that contains tuples with the name of the fruit and its price.
Filter the fruit_ prices list to include only fruits whose prices are between 1 and 3 dollars (inclusive).
Sort the filtered list in descending order by price.
Which of the following code snippets achieves this?
Pick ONE OR MORE options
fruit_prices = [(fruit,price)for fruit,price in zip(fruits,prices)]
filtered_fruit_prices = [fp for fp in fruit_prices if 1 <= fp[1] <= 3]
sorted_fruit_prices = sorted(filtered_fruit_prices,key=lambda x: x[1], reverse=True)
filtered_fruit_prices =[(fruit, price) for fruit, price in zip(fruits,prices)if 1<= price<= 3]
fruit_prices = sorted(filtered_fruit_prices, key=lambda x: x[1],reverse=True)
fruit_prices = [(fruit, price) for fruit, price in zip(fruits,prices) if 1= price <= 3]
filtered_fruit_prices = sorted(fruit_prices, key=lambda x: x[1],reverse=True)
fruit_prices =[(fruit,price) for fruit,price in zip(fruits,prices)]
filtered_fruit_prices =[fp for fp in fruit_prices if 1 <= fp[1]<= 3]
sorted_fruit_prices = sorted(filtered_fruit_prices,key=lambda x: x[1],reverse=False)
8. The Huffman Decoder
Huffman codes compress text by assigning the characters that occur at the highest frequency the shortest possible codes. In this encoding scheme, no code can be a prefix of another. For example, if the code for a is O1, then the code for b cannot be 011.
Given an array of Huffman code mappings and a Huffman-encoded string, find the decoded string. Each mapping will be a string consisting of a tab-separated ('t') character and its encoded value: 'c encoded value' where the whitespace is a tab character. The newline character is represented as the character [newline] in the codes list, but should translate to \n when decoded.
For example, given codes =('a 100100', 'b 100101'; '[newline] 111111')and the string encoded =100100111111100101 we do the following.
Break encoded into its constituent encodings.
100100
111111
100101
Now map them to their characters and return the string: 'a\nb'. This will print as:
a
b
Note: While all code mappings in the example are 6 digits long, mappings can be different lengths.The algorithm creates the shortest length mapping for the most frequent character encode
剩余60%内容,订阅专栏后可继续查看/也可单篇购买
本专栏主要发布嵌入式软件开发相关岗位2023年(2024届)的笔试真题(嵌入式软件开发、通用软件开发、C/C++软件开发、算法工程师、数据开发、测试开发等)主要是算法编程题,其中一些岗位笔试含有对应的选择题、填空题、简单题。