设为首页 收藏本站
查看: 972|回复: 0

[经验分享] 华为招聘Java面试题

[复制链接]

尚未签到

发表于 2016-6-6 08:42:54 | 显示全部楼层 |阅读模式
 第一部分:选择题

  QUESTION NO: 1

  1、public class Test {

  public static void changeStr(String str){

  str="welcome";

  }

  public static void main(String[] args) {

  String str="1234";

  changeStr(str);

  System.out.println(str);

  }

  }

  Please write the output result :

  QUESTION NO:2

  1. public class Test {

  2. static boolean foo(char c) {

  3. System.out.print(c);

  4. return true;

  5. }

  6. public static void main( String[] argv ) {

  7. int i =0;

  8. for ( foo('A'); foo('B')&&(i<2); foo('C')){

  9. i++ ;

  10. foo('D');

  12. }

  13. }

  14. }

  What is the result?

  A. ABDCBDCB

  B. ABCDABCD

  C. Compilation fails.

  D. An exception is thrown at runtime.

  QUESTION NO: 3

  1. class A {

  2. protected int method1(int a, int b) { return 0; }

  3. }

  Which two are valid in a class that extends class A? (Choose two)

  A. public int method1(int a, int b) { return 0; }

  B. private int method1(int a, int b) { return 0; }

  C. private int method1(int a, long b) { return 0; }

  D. public short method1(int a, int b) { return 0; }

  E. static protected int method1(int a, int b) { return 0; }

  QUESTION NO: 4

  1. public class Outer{

  2. public void someOuterMethod() {

  3. // Line 3

  4. }

  5. public class Inner{}

  6. public static void main( String[]argv ) {

  7. Outer o = new Outer();

  8. // Line 8

  9. }

  10. }

  Which instantiates an instance of Inner?

  A. new Inner(); // At line 3

  B. new Inner(); // At line 8

  C. new o.Inner(); // At line 8

  D. new Outer.Inner(); // At line 8//new Outer().new Inner()

  QUESTION NO: 5

  Which method is used by a servlet to place its session ID in a URL that is written to the servlet’s response output stream?

  A. The encodeURL method of the HttpServletRequest interface.

  B. The encodeURL method of the HttpServletResponse interface.

  C. The rewriteURL method of the HttpServletRequest interface.

  D. The rewriteURL method of the HttpServletResponse interface.

  QUESTION NO: 6

  Which two are equivalent? (Choose two)

  A. <%= YoshiBean.size%>

  B. <%= YoshiBean.getSize()%>

  C. <%= YoshiBean.getProperty("size")%>

  D. <jsp:getProperty id="YoshiBean" param="size"></jsp:getProperty>

  E. <jsp:getProperty param="size" name="YoshiBean"></jsp:getProperty>

  F. <jsp:getProperty id="YoshiBean" property="size"></jsp:getProperty>

  G. <jsp:getProperty name="YoshiBean" property="size"></jsp:getProperty>

  QUESTION NO: 7

  Which of the following statements regarding the lifecycle of a session bean are correct?

  1. java.lang.IllegalStateException is thrown if SessionContext.getEJBObject() is invoked when a stateful session bean instance is passivated.

  2. SessionContext.getRollbackOnly() does not throw an exception when a session bean with bean-managed transaction demarcation is activated.

  3. An exception is not thrown when SessionContext.getUserTransaction() is called in the afterBegin method of a bean with container-managed transactions.

  4. JNDI access to java:comp/env is permitted in all the SessionSynchronization methods of a stateful session bean with container-managed transaction demarcation.

  5. Accessing resource managers in the SessionSynchronization.afterBegin method of a stateful session bean with bean-managed transaction does not throw an exception.

  第二部分:概念题

  1. 描述Struts体系结构?对应各个部分的开发工作主要包括哪些?

  2 JSP有哪些内置对象和动作?它们的作用分别是什么?

  3、SQL问答题

  SELECT * FROM TABLE

  和

  SELECT * FROM TABLE

  WHERE NAME LIKE '%%' AND ADDR LIKE '%%'

  AND (1_ADDR LIKE '%%' OR 2_ADDR LIKE '%%'

  OR 3_ADDR LIKE '%%' OR 4_ADDR LIKE '%%' )

  的检索结果为何不同?

  4、SQL问答题

  表结构:

  1、 表名:g_cardapply

  字段(字段名/类型/长度):

  g_applyno varchar 8;//申请单号(关键字)

  g_applydate bigint 8;//申请日期

  g_state varchar 2;//申请状态

  2、 表名:g_cardapplydetail

  字段(字段名/类型/长度):

  g_applyno varchar 8;//申请单号(关键字)

  g_name varchar 30;//申请人姓名

  g_idcard varchar 18;//申请人身份证号

  g_state varchar 2;//申请状态

  其中,两个表的关联字段为申请单号。

  题目:

  1、 查询身份证号码为440401430103082的申请日期

  2、 查询同一个身份证号码有两条以上记录的身份证号码及记录个数

  3、 将身份证号码为440401430103082的记录在两个表中的申请状态均改为07

  4、 删除g_cardapplydetail表中所有姓李的记录

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-226829-1-1.html 上篇帖子: 华为交换机端口镜像 下篇帖子: 华为python面试题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表