笔试 & 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

/*
题目:	输入字符串,内容是十六进制数,输出连续1最长是多少。
input: 
	2FF
【 0010 1111 1111 最长连续1的个数为8 】 
output: 
	8
*/
#include<bits/stdc++.h>
using namespace std; 

//预设输入纯数据,且无其他符号,没有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 ;
}

2.字符串的频率

/*
题目:	输入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
*/
#include<bits/stdc++.h>
using namespace std; 

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 ;
}

#笔试#
全部评论
哥,编程题是考算法的吗
1 回复 分享
发布于 05-12 21:37 天津
视频题稳
点赞 回复 分享
发布于 07-09 10:02 广东

相关推荐

08-15 17:27
已编辑
华南师范大学 C++
2025/8/14&nbsp;字节客户端一面:自我介绍项目10分钟在学习/项目中,最有挑战的事情是什么操作系统1.进程和线程的理解2.进程间的通信:管道,消息队列,信号/信号量计网:3.http和https的优缺点4.https建立连接的流程:TCP连接,最后发送密钥5.密钥是从哪里获取的6.数据传输时用的什么加密方式:对称加密7.为什么不用非对称加密:资源消耗,密钥发送安全性,面试官补充时效性?数据库:8.数据库索引有什么用,什么时候建立索引,建立在什么字段上,什么时候适用什么时候不适用?C++:9.C++和其他语言在设计上有什么区别?10.C++中没有interface字段,c++用什么来定义接口:应回答抽象类11.C++抽象类和普通类的区别12.虚函数和纯虚函数有什么区别在c++中,现有类A和类B,在A和B中声明了一个完全相同的虚函数,现有一个类c,c继承A和B,那么在c中能否调用A和B声明的哪个虚函数,如何确定调用的是A还是B的虚函数:(1)如果C没有覆盖该虚函数,直接调用会编译失败(歧义错误)(2)通过作用域解析运算符::显式指定调用哪个基类的版本(3)若C覆盖了该函数,调用c.func()会执行C的版本,但仍可通过作用域调用基类版本(4)通过基类指针调用时,行为由指针类型决定13.Std::move和普通的赋值语句有什么区别14.String&nbsp;A=“asdasd”&nbsp;string&nbsp;B=move(A)&nbsp;之后还可以访问A吗15.什么场景下会用到shared_ptr16.shared_ptr的循环引用怎么解决17.线程安全的问题会出现在什么场景下18.乐观锁和悲观锁:一个在循环检测,一个不循环检测19.除了c++还会用其他语言么20.平时会用AI去帮忙写代码么手撕,二叉树,判断是否存在一条路径,所有节点的和等于目标值,从根节点出发求求给个机会!&nbsp;8.15已挂
查看25道真题和解析
点赞 评论 收藏
分享
评论
7
35
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务