笔试 & CVTE-嵌入式单片机方向实习

形式:笔试和视频题分开考,视频有2分钟准备,5分钟答题;笔试有20(单选多选都有)+2(编程题)有90分钟。

有感:准备不充分,而且题目填了不能回头,代码不能调试,只能告诉编译成不成功,唉寄了。

题目知识:

1.查看linux使用了多少内存 ——命令cat/proc/meminfo

2.Kill 9命令的意思 向目标进程发送 SIGKILL 信号(编号为 9)

3.嵌入式存储速度最快的是A 寄存器组,cache ,内存, flash

SRAM与DRAM的区别

4.哈佛结构

5.嵌入式存储结构的分配需遵循“Bootloader→内核→参数→文件系统”的物理顺序。

存储区域 地址范围 内容 大小

Bootloader 0x0800_0000 启动代码、中断向量表 64 KB

内核代码 0x0801_0000 内核.text段 512 KB

参数区 0x080F_0000 系统配置、校准数据 32 KB

文件系统 0x0810_0000 UBIFS分区 1 MB

6.IIC与SPI的区别。

7.bootcmd 是 U-Boot 引导加载程序的核心环境变量,定义了系统启动时自动执行的命令序列

8.线程与进程的区别

9.USB、UART 异步时序 ; IIC、SPI、PCI同步

视频题:中断能不能有延时操作?不能又是为什么?有什么优化方案?

编程题:

1.输入“2FF” 0010 1111 1111 输出8

#include<bits/stdc++.h>
using namespace std; 
/*
	输入n个字符串,输出频率最高的一个和它的频率
input: 
5
168.192.0.1 2021-01-02T00:11:11
168.192.0.2 2021-01-02T00:11:11
168.192.0.3 2021-01-02T00:11:11 
168.192.0.1 2021-01-02T00:11:11
168.192.0.1 2021-01-02T00:11:11
output: 
168.192.0.1 3
*/
typedef struct {
	char *str ;
	int count ;
}String_T;

int main()
{
	int different_count = 0 ;
	char temp[35];
	char str_in[35];
	
	int n ;
	scanf("%d\n",&n);
	String_T *list = ( String_T* )malloc( n*sizeof( String_T ) );
	for( int i = 0 ; i < n ; i++ ){
		if( i == n-1 ) { scanf("%s %s",str_in ,temp ); }
		else { scanf("%s %s\n",str_in , temp ); }
		
		bool flag_finish = false ; //没操作本次输入 
		for( int j = 0 ; j < different_count ; j++ ){
			if( strcmp( list[j].str , str_in ) == 0  ){
				list[j].count++ ;
				flag_finish = true ;
			} 
		}
		if( flag_finish == false ){ //没操作,说明是新的字符串 
			list[different_count].str = strdup( str_in )  ;//需要配备free 
			list[different_count].count = 1 ;
			different_count++ ;
		}
	}
	int max_count = 0 ;
	for( int i = 0 ; i < different_count ; i++ ){
		if( list[i].count > max_count  ){
			max_count = list[i].count ;
		} 
	}
	for( int i = 0 ; i < different_count ; i++ ){
		if( list[i].count == max_count  ){
			printf("%s %d\n",list[i].str , max_count);
			break ;
		} 
	}	
	//free
	for( int i = 0 ; i < different_count ; i++ ){
		free( list[i].str );
	}	
	free( list );
	
	return 0 ;
}

2.字符串的频率

#include<bits/stdc++.h>
using namespace std; 
/*
	输入n个字符串,输出频率最高的一个和它的频率
input: 
	2AA
【 0010 1111 1111 最长连续1的个数为8 】 
output: 
	8
*/
//预设输入纯数据,且无其他符号,没有0x  base填写进制数 
unsigned long long My_easy_strtoull( const char *str ,int base){
	const char *ptr = str ;
	unsigned long long res = 0 ;
    // 转换循环
    for (; *ptr != '\0'; ptr++) {
        int digit;
        if (isdigit(*ptr) && (*ptr - '0') < base) { //是否0-9 
            digit = *ptr - '0';
        } else if (isalpha(*ptr)) { //是否字母 
            char c = tolower(*ptr); //统一小写 
            if (c >= 'a' && c < 'a' + base - 10) {
                digit = c - 'a' + 10;
            } else {
                break; // 非法字符
            }
        } else {
            break; // 非法字符
        }
        res = res * base + digit;
    }	
	return res ;
}
int strhex_to_max_ones(const char *hex_str){
	int res = 0 ;
	
	char *endptr ; //char **endptr ; strtoull函数输入是char** ,这里定义char* ,再取地址也是一样的
	//unsigned long long num = strtoull(hex_str, &endptr, 16) ;
	unsigned long long num = My_easy_strtoull(hex_str,16) ; 
	printf("%lld\n",num);
	int max_count = 0 ; 
	int current_count = 0 ;
	
	for( int i = 0 ; i < sizeof(num)*8 ; i++ ){ //字节数*8 = bit位 
		if( (num >> i) & 1ULL ){
			current_count++ ;
			max_count = (current_count > max_count) ? current_count : max_count ;
		}else{
			current_count = 0 ;
		} 
	}
	res = max_count ;
	return res ;
}
int main()
{
	char str[8] ;
	scanf("%s",str);
	int ans = strhex_to_max_ones(str);
	printf("%d\n",ans);
	return 0 ;
}

#笔试#
全部评论
哥,编程题是考算法的吗
点赞 回复 分享
发布于 昨天 21:37 天津

相关推荐

bg双非本嵌入式,个人从初中的时候就非常喜欢嵌入式,当然也因为喜欢嵌入式和其他各种原因高中没认真学习,最终进了双非非电类专业(经管),那个时候一进大学就想着转专业,最终也是拿到了年级前三的绩点成功转入了学校的电信专业,还连着进入了学校最好的机器人实验室,大二大三全凭着热爱一口气撑着,本来跨大专业就很难(我没选择降级),一年上两年的课还连着打各种比赛,根本无法平衡转专业后的double学业,大三打完比赛后挂了两科,秋招一边准备一边准备挂科考试的补考,我发现从准备秋招开始整个人就开始严重失眠,一直到现在快毕业,现在回望自己的大学生涯,虽然是学到了很多真本事,但是感觉自己除了热爱,还是被焦虑和不安催着往前走,好像为了嵌入式很少有自己时间,大学期间更是很少出去玩过,最后到了秋招还是感觉嵌入式今年非常的地狱,自己这么多年的积累,在各个需求不一的公司面前其实还是被挑三拣四的下场,最终只拿到了三个offer,其他两个都是千人的公司,但是996常态,最终选择了年包15W离家30多公里的三百人厂,最近做完毕设真的感觉学累了,毕设也是公司出的,熬了一个月才做出来,本来想着毕设做完好好总结一下的,但是现在不知道为什么真的提不起劲了。图片放一些自己做过的东西吧
点赞 评论 收藏
分享
评论
点赞
3
分享

创作者周榜

更多
牛客网
牛客企业服务