Alibaba 2016 school strokes questions (including answers, analysis)

Source: Internet
Author: User
Tags strtok

3, the 1,2,3,......, 99,100 arbitrarily arranged into a circle, the difference between the two adjacent numbers is the absolute sum of the maximum ()
a:100
b:198
c:200
d:500
e:2500
f:5000
Answer: F

4, if the following formula is established: 84*148=B6A8. It is represented by () the system.
A:15
B:11
C:12
D:14
E:16
F: None of the above is right
Answer: C

Analytical:
1. Conventional approach: Assuming that the value is x, then write out the equation: (8x+4) (x2+4x+8) =11x3+6x2+10x+8, Simplify (3x2+6x+2) (x-12) = 0, then x's nonnegative integer solution is x=12.
2, "heuristic" approach: in the decimal system, the left-digit product 4*8=32, the right bit for 8, the difference 32-8=24, so that the system must be 24 of the approximate. Only the C option 12 is a divisor of 24.

5, in the 1,2,3,...... 1000, there are () the number of the product is 0.
a:100
B:101
c:172
d:181
e:190
f:191
Answer: D 181

Analytic: The nature of the topic is to ask for the number 0. Divided into three types of discussion:
1, in one digit, no number is 0;
2, two digits, only the whole 10 of the number contains the number 0, a total of 9;
3, three digits are divided into 1 0 and two cases:
3.1 If only a single digit is 0, then 10 digits and hundreds each have 9 kinds of ways, altogether 81 kinds of the extraction;
3.2 If only 10 digits are 0, there are 9 kinds of single digits and hundreds, and a total of 81 kinds of extraction;
3.3 If the digit and 10 digits are 0, then the Hundred has 9 kinds of ways.
4, 1000 is in itself 1 effective ways.
Fully, a total of 0 (a number) + 9 (two digits) + 81+81+9 (three digits) + 1 (four digits) = 9+171+1=181 species.

6, there is a one-way linked list in the queue has a A, b two adjacent elements, there is a pointer p point to element A, now a pointer r points to the s element to insert between A and B, the operation ()
A:p->next=p->next->next
B:r->next=p;p->next=r->next
C:r->next=p->next;p->next=r
D:r=p->next;p->next=r->next
E:r->next=p;p->next=r
F:p=p->next->next
Answer: C

Parsing: The basic pointer operation. You need to assign the successor of P to the successor of R, and then point P's successor to R.

9, a length of 99 cycle chain list, both pointer A and pointer b point to the same node in the list, and a moves forward with a step length of 1, and B moves forward with step 3, and how many steps a and B can be moved at the same time to point to the same node again ().
a:99
b:100
C:101
d:49
E:50
F:51
Answer: A

Parse: Assume that after n steps a, b meet again. Then the node of a is 3n through the node of the n,b; at the moment B is bound to be more than a multiple of the chain table length (the length of the loop), assuming that after I-fold the length of the linked list, there is 3n-n=99i, that is, 2n=99i, the minimum integer number of i=2,n=99 to satisfy the equation. That is, a after 99 nodes, b through the 297 nodes, the two met again.

10, consider the following two points to find code:

Include<stdio.h>int bsearch (int array[], int n, int v)
{
int left, right, middle;
left = 0, right = n-1;
While [left <= right]
{
    middle = left + (right-left)/2;
    if (Array[middle] > V) Right
        = middle;
    else if (Array[middle] < v) left
        = middle;
    else return
        middle;
}
return-1;
}

For input array: {2, 6, 8,,,, 127},n, V = 127, when the bsearch function is run, while the number of times the Loop call is ()
A:1
B:2
C:3
D:4
E:5
F: Unable to exit
Answer: F

Analytical:
Because the left assignment is middle after the execution of if (Array[middle] < v), if left and right differ only by 1, middle still equals left, causing binary lookup code to exit. And look for 127 exactly happened this kind of panic. In fact, if the above code is working properly, leave = middle should be replaced with left = middle + 1 to form the correct code as follows. (Also, right = Middle can actually be replaced by right = middle-1).

int bsearch (int array[], int n, int v) {
int left, right, middle;
left = 0, right = n-1;
While [left <= right]
{
    middle = left + (right-left)/2;
    if (Array[middle] > V) Right
        = middle;
    else if (Array[middle] < v) Left
        = middle + 1;
    else return
        middle;
}
return-1;
}

11, a stack of banknotes in the bag, of which 5-dollar notes 6, 10-dollar notes 5, 20-dollar notes 4, from the bag arbitrarily 4 notes, then the probability of at least one of each face value ()
A:8/91
B:25/91
C:48/91
D:53/91
E:60/91
F:63/91
Answer: C

12, the product recommendation scenario is too focused on the product recommendations will often damage the user's shopping experience, in some scenarios, the system will be a certain degree of randomness to the user to bring a sense of surprise. Suppose in a recommendation scenario, The matching degree of two items A and B with the current access user is 0.8 points and 0.2 points respectively, the system randomly generates a final score evenly distributed between 0 and 0.8 for B to generate a final score evenly distributed between 0 and 0.2, then the probability of the final B score greater than A is ()
A:1/16
B:1/8
C:3/16
D:3/8
E:1/4
F:1/3
Answer: B

Parsing: The a=b of a line above the area, that is, the B>a case. s Blue =0.02 s rectangle = 0.16,
Thus, p=0.02/0.16=0.125

13, the following Java code Description of the correct option is ()

public class TestClass {
private static void TestMethod () {
    System.out.println ("TestMethod");
}
public static void Main (string[] args) {
    ((TestClass) null). TestMethod ();
}

A: compilation does not pass
B: Compile pass, run abnormal, report nullpointerexception
C: Compile pass, run abnormal, report lllegalargumentexception
D: Compile pass, run abnormal, report nosuchmethodexception
E: Compile pass, run abnormal, report exception
F: normal operation, output TestMethod
Answer: F

Parsing: TestMethod () is a static method and does not belong to any object, so its invocation has no relation to whether the class is instantiated or not. ((TestClass) null). TestMethod () The compiler detects that the method is a static method, equivalent to Testclass.testmethod () at the time of the call, and executes normally.

14, there is a class B inheriting subclasses, their data members are as follows:

Class a{...
Private:
  const int A;
};
Class B:public a{...
Private:
  int A;
Public:
  const int B;
  A C;
  static const char* D;
  a& e;
};

These member variables must be initialized by the constructor initialization list of A or B ().
A:B C
B:b C E
C:b C d E
D:c E
Answer: B

Resolution: Constants must be initialized in the initialization list. Otherwise, because constants cannot be modified, any other place that is left is an error; A::a, b::b is this type, where a::a is overridden by b::a in class B, but B::c must be initialized by class A's initialization list. The reference type must be initialized, so you can also initialize;a& e to this type only in the initialization list.

15, A, B, C, D four people apply for a programmer position, the requirements of this position is: Java proficiency, understand database development, web development, have C + + experience. Those who meet the most conditions, who are employed.
Combine the above four requirements with 22, each of which is satisfied by one person. Also known
A and B Java skilled
B and C web
C and D understand the database
D has c + + experience
So, the employed are ()
A:a
B:b
C:c
D:d
E: Equal opportunities for four people
F: Above all wrong
Answer: B

16, from the 1,2,3,......, 99,2015 Optional part of the number (may be 0), this part of the number of different or up to the expected value is ()
a:512
b:1007
c:1008
D:2015/2
e:1024
F:2047/2
Answer: F

17, in the following functions, and other functions are not part of the class is ()
a:strcpy
b:strcpy
c:snprintf
D:strcat
E:strtok
F:strncat
Answer: C

Analytical:
Char strcpy (char dest, const char *SRC) copies the string that is pointed to by SRC to the address space in dest direction; int snprintf (char *str, size_t size, const char *format , ...) is formatted as a string in format and then copied into str; char *strcat (char *dest,char *src) adds the string src refers to the end of the dest; Char *strtok (char s[], const char *delim) is the decomposition of the string s according to the Delim delimiter into a set of strings. Char *strncat (char *dest,char *src,int N) adds the first n characters of the string src refers to the end of the dest.

The article comes from http://ask.julyedu.com/question/6951

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.