[面试]上海美国运通面试题

题目


第一题 :运行的结果

class  a
{
	public static void main(String[] args) 
	{
		String str ="World";
		char[] ch = {'H','e','l','l','o'};
		change(str,ch);
		System.out.println(str);
		System.out.println(ch);
	}

	private static void change(String str,char[] ch){
		str ="Change";
		ch[0] = 'C';
	}
}

答案:
World
Cello

第二题
解法一
List<Integer> A =new ArrayList<Integer>();
List<Integer> B =new ArrayList<Integer>();
List<Integer> C =new ArrayList<Integer>();
for (Integer i : A) {
	if (!B.contains(i)) {
		C.add(i);
	}
}
解法二
  int[] A ={1,3,5,7,9};
		int[] B ={1,3,5};
		List<Integer> C =new ArrayList<>();
		for (int i : A) {
			Boolean flag=true;
			for (int j : B) {
				if (i==j) {
					flag= false;
				}
			}
			if (flag) {
				C.add(i);
			}
		}
解法三:
A =[1,2,3,4,5]
B =[1,2,3]
C =[]
for i in A:
	if i not in B:
		C.append(i)
print (C)

第三题:
SELECT DISTINCT t1.Id,t1.Name,t1.Salary
FROM yuntong t1 ,yuntong t2 
where t1.`Name`=t2.`Name` 
AND t1.Salary=t2.Salary 
AND t1.Id !=t2.Id

第四题
select s.s_name from student s where s_id in (
	select sc.s_id from student_course sc right join course c 
	where c.c_id =sc.c_id 
	and c.c_name ='Math'
	and sc.score>(select sum(score) form student_course)+15
)





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值