笔试题整理

爱奇艺

1、int a=5;int b=7;int rst=(a++)+(b++);rst=?

解析:x++操作符相当于一个函数调用,x是函数参数,++在x之后返回值是x,++在x之前返回的的x+1。所以rst=12;

2、以中文为主的文章,以下哪种编码方式使存储空间最小?

A、GBK   B、UTF-8   C、Unicode   D、UCS-4

解析:Unicode为确定了所有字符(包括中文)的对应二进制数,但没有规定应该如何存储,UTF-8是对unicode字符的一种变长存储方式,英文1个字节,中文3个字节,GBK对所有的中文用2个字节存储,但不同通用,GBK编码的汉字在其他国家是乱码,UCS-4是UTF-32统一用4个字节存储。所以答案应该是A。

IGT

public class Test{
	public static void main(String[] args){
		Base b=new Derived();
	}
}


class Base{
	static{
		System.out.println("6");
	}
	{
		System.out.println("5");
	}
	public Base(){
		System.out.println("4");
	}
}


class Derived extends Base{
	static{
		System.out.println("3");
	}
	{
		System.out.println("2");
	}
	public Derived(){
		System.out.println("1");
	}
}

输出:

6 3 5 4 2 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值