Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language programming master, please answer a few tc program questions.
C language programming master, please answer a few tc program questions.
★ The topic is here: ★ (Continue to post) I am the landlord.

1 set

Description of test questions

***********************************

The first question (30 points)

A one-way linked list with a head node has been established in a given program, and each node in the linked list is based on node data.

The data in the domain is linked from small to large. The function of fun is to put the value of parameter x into a new node.

And insert it into the linked list. After insertion, the nodes still keep the order from small to large.

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C is to calculate and output 13 or the largest 10 functions that can be calculated.

17 is the sum of divisible natural numbers. The value of k is passed in by the main function. If the value of k is 500, the function value is 4622.

Please correct the errors in the program so that the program can output correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

The fun function is used to count the number of times the specified character appears in the string A, and count the number of times.

The data is stored in the b array. Where: the occurrence number of the character' a' is stored in b[0], and the occurrence number of the character' b' is stored in.

In b[ 1], the occurrence times of the character' c' are stored in b[2], and the occurrence times of the character' d' are stored in b[3].

The number of occurrences of the character "e" is stored in b[4], and the number of occurrences of other characters is stored in b[5].

For example, when the string in A is "bacd 1b+ddep", after calling this function, the data stored in B should be:

1、2、 1、3、 1、3。

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Set 2

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to call the fun function to copy the contents of the specified source file to the specified target.

In the file, the return value of the function is 1 when the copy is successful, and 0 when the copy fails. In the process of copying, complex

The content of the system is output to the terminal screen. In the main function, the source file name is placed in the variable sfname, and the target file name is placed in the.

In the variable tfname.

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Given the function of the program MODI 1. C is to read a line of English text and put the last word in it.

Capitalize the letters, and then output this line of text (words here refer to strings separated by spaces).

For example, if you enter that I am a student taking the exam. ,

"I am a student who came to take the exam." It should be output.

Please correct the mistakes in the program so that it can calculate the correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

Write the function fun, its function is to calculate and output the sum of the following series:

1 1 1

s = —+ —+…+——

1×2 2×3 n(n+ 1)

For example, when n = 15, the function value is 0.937500.

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Episode 3

Description of test questions

***********************************

The first question (30 points)

In a given program, the function of fun is to write the natural number 1 ~ 10 and its square root into a file named.

In the text file of myfile3.txt, and then read it out in turn and display it on the screen.

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

It is known that the first three terms of a sequence are 0, 0, 1 respectively, and the following terms are the sum of the first three adjacent terms.

Function of fun in given program MODI 1 C is the sum of the square roots of the first n terms of the series.

The value of the sum. n is passed through a formal parameter.

For example, when n= 10, the program output should be: 23.438+045.

Please correct the errors in the program so that the program can output correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

Please write a function fun (int * a, int n, int * odd, int * even), which is used for division.

The sum of all odd numbers and the sum of all even numbers in the array A are not required, and the formal parameter n gives the number of data in the array;

Odd returns the sum of odd numbers, and even returns the sum of even numbers.

For example, the values in the elements of array A are: 1, 9, 2, 3, 1 1, 6; Then return odd numbers through odd.

The sum of 24; Then the sum of even numbers is 8 to even numbers.

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

The fourth episode

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to input several lines of text (no more than 80 characters per line) from the keyboard and write.

In the file myfile4.txt,-1 is used as the ending symbol of string input. Then read out the contents of the file.

Displayed on the screen. Reading and writing files are realized by user-defined functions ReadText and WriteText respectively.

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C is the largest 10 pixel in high.

The sum of numbers. High is passed from the main function to the fun function.

If the value of high is 100, the value of this function is 732.

Please correct the errors in the program so that the program can output correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

The program defines an N×N two-dimensional array, which is automatically assigned in the main function. Please write a function.

Fun(int a[][N]), the function is to set all the values in the upper triangle elements of the array to 0. For example:

The values in the array are

| 1 9 7 | | 0 0 0 |

A = | 2 3 8 | The value in the A array should be | 2 0 0 | after returning to the main program.

| 4 5 6 | | 4 5 0 |

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Episode 5

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to call fun function to establish class address book. The address book records each student's

Number, name and telephone number. Read in the class number and student information from the keyboard, and everyone's information is made.

Write the data block to a binary file named myfile5.dat

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C is the lower 3 digits of the integer x to the y power. For example, the whole

The sixth power of the number 5 is 15625, and the lower three digits of this value are 625.

Please correct the error in the specified part of the fun function to get the correct result.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

The fun function is used to add the number of n in the A array with the number of n in the reverse order in the B array.

The result exists in the c array.

For example, when the values in array A are: 1, 3,5,7,8, the values in array B are: 2,3,4,5,8.

After calling this function, the data stored in the C array are 9, 8, 9, 10 and 10.

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Episode 6

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to sort six strings by bubble method.

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C is to exchange two integers.

For example, input 60 and 65 to A and B respectively, and the output is: a = 65 b = 60.

Please correct the mistakes in the program so that it can get the correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

Write a function and read several strings from it (use * * * as the sign of the end of input).

Output a longest string and output it.

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Episode 7

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to convert a decimal positive integer m into a digital output of a K-ary (2≤k≤9) number.

For example, if you enter 8 and 2, you should output 1000 (that is, when the decimal number 8 is converted into binary, it means 1000).

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C is reading an English sentence less than 63 characters long.

Son, change the last letter of each word to uppercase, and then output this sentence (the word here)

Refers to strings separated by spaces).

For example, if you enter

"I am a student who came to take the exam." ,

"I am a student who came to take the exam." It should be output.

Please correct the mistakes in the program so that it can get the correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

The program defines an N×N two-dimensional array, which is automatically assigned in the main function. Please write a function.

Fun(int a[][N]) is used to make the values in the first row and the last row of elements in the array.

The value in will be inverted, the value in the second row of elements will be inverted with the value in the penultimate row of elements, and so on.

Analogy. For example, the values in the array are

|0 1 1 12 7 9|

| 1 9 7 4 5|

a = |20 13 18 3 1|

| 14 5 6 8 2|

| 15 9 17 4 1|

| 15 9 17 4 1|

| 14 5 6 8 2|

Then the value in array A after returning to the main program should be | 201318 31|.

| 1 9 7 4 5|

|0 1 1 12 7 9|

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Episode 8

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to form characters that do not appear in the string S but appear in the string T.

A new string is placed in U, and the characters in U are arranged in the order of the characters in the original string, but the repeated characters are removed.

For example, when S = "12345" and T = "24677 ",the character in U is" 67 ".

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

For example, when k is 10, the function value should be: 1.852.

Please correct the errors in the program so that the program can output correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Episode 9

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to form a character that appears in the string S but not in the string T.

A new string is placed in U, and the characters in U are arranged in the order of the characters in the original string, without removing the repeated characters.

For example, when S = "1 12345" and T = "2467 ",the string in u is" 1 135 ".

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C subscripts the string s at even positions.

Characters, followed by a repetition, are placed in the new string T, and the characters in the T are displayed as the characters in the original string.

In the reverse order. (Note that 0 is an even number)

For example, when the string in S is "123456", the string in T should be "5533 1 1".

Please correct the mistakes in the program so that it can get the correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

Write the function fun, whose function is to find all the properties within n (excluding n) that can be divisible by 3 and 7 at the same time.

The square root s of the sum of numbers and returns it as a function value.

For example, if n is 878, the function value should be: S = 1309.

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

10 set

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to repeat the odd-numbered subscript characters in the string S, followed by them.

Now, put it in a new string T, and the characters in T are arranged in the reverse order of the characters in the original string. (Note that 0 is

Even number)

For example, when the string in S is "1234567", the string in T should be "664422".

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C is to realize the intersection of two variables in some way.

For example, after the program runs, the value in the variable A is 8, the value in B is 3 and the value in A is 3.

The value in b is 8.

Please correct the mistakes in the program so that it can get the correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

The fun function squares the number of n in array A and the number of n in array B in reverse order.

Subtract the square values one by one, and the result is stored in the C array.

For example, when the values in array A are: 1, 3,5,7,8, the values in array B are: 2,3,4,5,8.

After calling this function, the data stored in C are: -63,-16, 9, 40, 60.

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.

Set 1 1

Description of test questions

***********************************

The first question (30 points)

The function of a given program is to convert uppercase letters into the fifth letter after the corresponding lowercase letters; Ruoxiao

Write the letters as v ~ z, so that the value of lowercase letters is reduced by 2 1. The converted lowercase letters are returned as function values. For example,

If the formal parameter is the letter a, it is converted into lowercase letter f; If the formal parameter is the letter w, it is converted to lowercase letter B.

Please fill in the correct content at the underline of the program and delete the underline, so that the program can get the correct conclusion.

Fruit.

Note: The source program is stored in BLANK 1 C under the examinee folder.

Don't add or delete rows or change the structure of the program!

***********************************

The second question (30 points)

Function of fun in given program MODI 1 C subscripts the string s at even positions.

Characters, followed by a repeat, are put into a new string T, and the characters in T are arranged in the order of the characters in the original string.

Orderly arrangement (note that 0 is an even number)

For example, when the string in S is "12345", the string in T should be "1 13355".

Please correct the mistakes in the program so that it can get the correct results.

Note: Do not change the main function, add or delete lines, or change the structure of the program!

***********************************

The third question (40 points)

The fun function squares the number of n in array A and the number of n in array B in reverse order.

The squared values are multiplied one by one, and the results are stored in the C array.

For example, when the values in array A are: 1, 3,5,7,8, the values in array B are: 2,3,4,5,8.

After calling this function, the data stored in C are: 64,225,400,441,256.

Note: Some source programs exist in the PROG 1 file. C

The main function and other functions do not make any changes, but only fill in the curly braces of the function fun.

Some statements you wrote.