2015 Hang Seng Electronic School recruit written examination

Source: Internet
Author: User

Detailed Answer:

First, the choice question

1, BD C language to be compiled into binary code, and then connected to form an. exe executable file.

2, D 3 kinds of traversal mode of the cross-push.

3, D Private members can only be accessed by this class

4, the CD index is not the more the better, especially the composite index.

5, B mainly look at the SQL statement where is ture.

6, B ABCD directly through A; in turn, all into the stack to C;a stack, BCD directly over, a out of the stack d.

7. The DA value call means that the method receives the value provided by the caller, does not change the argument, and the reference invocation represents the address of the variable supplied by the caller, changing the argument.

8, D because D is the most abstract, C is wrong, there are chains, trees and so on.

9, C 1000|0001=1001>>1=0100=4.

10, CD D for the directory, W is write, R is read, X is executed, not 3 a group, is all, user group or other user, that is, the user group for R-x, has read and execute permissions.

Second, the Java language section

1, B

2, C

3, AB a affirmed the string, b characters more, CD Normal, can be used in Chinese and Unicode code declaration.

4, AC ( -5)%2=-1,b error; d exceeds int range.

5, C frequently examination questions, http://www.cnblogs.com/dingshilei/p/4107583.html 23 questions analysis.

Third, the database

1, select distinct s.sname from S,C,SC where SC. Sno=s.sno and SC. Cno=c.cno and C.cname= "database" ORDER by S.sname DESC;

2, select DISTINCT SC. Sno,c.ccredit from Sc,c where C.ccredit >80 and SC. grade>60;

3. ALTER TABLE SC add Teacher varchar (a) not null;

4, CREATE View scsum as Select Sno,sum (Grade) from the SC group by Sno;

5, Delect from SC where Sno not in (select Sno from S);

Four, programming problems

Note to determine whether it is a leap year, a leap year in February will add another day.

#include <stdio.h>structDate {intYear ; intmonth; intDay ;}; intLeap_year (inta);intCal_day (structdate a);/*Judging Leap years*/ intLeap_year (inta) {    if(a% -==0|| (a%4==0&&a% -!=0))         return 1; Else         return 0;}/*calculate the day ordinal of a year*/ intCal_day (structdate a) {    intsum=0, b[]={ to, -, to, -, to, -, to, to, -, to, -, to} ;  for(intI=0; i<a.month-1; i++) Sum+=B[i]; if(a.month>2) Sum=sum+a.day+leap_year (a.year); Elsesum=sum+A.day; returnsum;} voidMain () {structdate A; intN; printf ("\ n Please enter the date (month day) \ n"); scanf ("%d%d%d",&a.year,&a.month,&a.day); N=Cal_day (a); printf ("the date is%d days in this year \ n", n);}

Five, algorithm problem

1, the basic idea is to determine whether the composite factor is a prime number, and then the for loop iteration is completed.

ImportJava.util.Scanner; Public classtry{Static BooleanIs_odd (intN//determine if it is a prime number  {   if(n==2| | N==3)return true; if(n%2==0)return false; inti;  for(i=3;i<=n/2;i+=2)    if(n%i==0)return false; return true; }    Public Static voidMain (string[] args) {Scanner in=NewScanner (system.in); System.out.println ("Enter Value"); intn=In.nextint (); inti; System.out.print (n+"=");  for(i=2;i<=n;i++)   {    if(!is_odd (i))Continue; if(n%i==0)    {      while(true) {System.out.print (i); N/=i; if(n!=1) System.out.print ("*"); if(n%i!=0) Break;  }}} System.out.println (); }}

You can also use recursive methods to implement http://blog.csdn.net/YidingHe/article/details/3952651.

    Importjava.util.List; Importjava.util.ArrayList; /*** Decomposition factorization*/       Public classGetfactor { Public Static voidMain (string[] args) {List<Long> factors = getfactors (5555566666L, 2);          SYSTEM.OUT.PRINTLN (factors); }                 /*** Decomposition factorization by recursive implementation * *@paramn the number to decompose *@paramfactor Starting factor * *@returnDecomposition Results*/          Private StaticList<long> Getfactors (LongNLongfactor) {              //increase factor until you can divide n             while(n% Factor! = 0 && Factor <N) {//Get 2,3,5,7,9,11,13,...Factor = Factor < 2? 2:factor = = 2? 3:factor + 2; } List<Long>result; if(Factor >= N) {//The factor has risen to as large as n, stating that n itself is a factor.  At this point the recursion is completed. result =NewArraylist<long>(); } Else{//factor can divide N, and then continue to divide the result after the factorresult = Getfactors (N/factor, factor);//recursive down} result.add (factor); returnresult; }      }  

2015 Hang Seng Electronic School recruit written examination

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.