Set of multiple choice questions for programming with P15 prize
- Question 1. Choose the correct answer
FILE * f = fopen ('FL.txt', 'r');
int n = 7; fprintf (f, '% d', n);- The code causes an error
- The code is not error
- This code will write 7 to the 'FL.txt' file.
- This code will read a value from file 'FL.txt' into variable n
-
- Question 2. Declaring the function reading a text file into an array of integers, choose the correct declaration:
- void Read (char * fName, int a []);
- void Read (char * fName, int a);
- void Read (char * fName, int * a);
- void Read (char * fName, int * & a, int & n);
-
- Question 3. Suppose f is a binary file pointer. To read the word f for variable x of type int, we can use:
- fscanf (f, '% d', x);
- fread (& x, sizeof (int), 1, f);
- getw (f);
- 2 and 3 right
-
- Question 4. Select the best sentence in the following sentences:
- When reading a character with code 1A from a text file, C will read into a character with code -1
- When reading text files, both OD and OA characters will be read by C into 1 character with OA code
- When reading the character with the OD code from the text file, C will ignore it
- 1, 2 and 3 are all right
-
- Question 5. For declaring FILE * f1, * f2; int c; and the command:
f1 = fopen ('source', 'rt'); f2 = fopen ('TARGET', 'wt'); while ((c = fgetc (f1))! = EOF) fputc (c, f2);
- The 'source' file length is always smaller than the length of the 'TARGET' file.
- The file 'source' length equals the length of the file 'TARGET'.
- The 'source' file length is generally larger than the length of the 'TARGET' file.
- The length of the 'source' file will generally be greater than the length of a 1-byte 'TARGET' file.
-
- Question 6. Which of the following functions is only used to read 1 character from a file:
- getch ();
- fscanf ();
- fgetc ();
- scanf ();
-
- Question 7. Which of the following functions is only used to write one character to a file:
- putch ();
-
puts ();
- fputs ();
- fputc ();
-
- Question 8. Which of the following functions is used to write 1 string of characters to the file:
- putch ();
- fputc ();
- fputs ();
- puts ();
-
- Question 9. Suppose the DATA file contains 5 bytes: '70, 26, 13, 10, 44 '. Give the command. What is the result of the above program?
FILE * f;
char ch; f = fopen ('DATA', 'r');
while (! feof (f)) {ch = fgetc (f); printf('%c',ch);}; printf ('% c', ch);}; fclose (f);- '70, 26,13,13,10,44 '.
- '70, 26,13,10,44 '.
- '70, 26,10,44 '.
- The script failed
-
- Question 10. Give the DATA binary file containing the sequence of adjacent structures L struct T {.} x, and f is the file pointer to DATA. Choose the best sentence in the following sentences:
- The command fseek (f, 10, SEEK_END) locates the file pointer to the 10th byte in the file
- The command fseek (f, 10, SEEK_END); Locate the cursor to the end of the file
- Assuming the file has n structures, the command fseek (f, n, SEEK_SET) will place the pointer to the final structure of the file.
- Assuming the file has n structures, the command fseek (f, n, SEEK_CUR); will not change the cursor position of the file
-
4 ★ | 1 Vote
You should read it
- Set of multiple choice questions about programming with P7 prize
- P13 programming set of multiple choice questions
- Set of multiple-choice questions on award-winning programming P5
- Set of multiple choice questions about programming with P6
- Set of multiple choice questions on programming with P16 prize
- A set of multiple choice questions for programming has a P2 prize
- Set of multiple choice questions for programming with P8 prizes
- Set of multiple choice questions on programming with P14 prize
May be interested
- Set of multiple choice questions on programming with P16 prizemultiple choice questions about programming will be the first piece of knowledge to help you get started with programming. invite your reference.
- Set of multiple choice questions about programming with P17 prizeto become a true programmer, you first need to master the knowledge of this discipline. to help readers easily get acquainted with this subject, network administrator has synthesized and sent you extremely interesting multiple choice questions. invite your reference.
- You have confidence in your knowledge of Network Administration P5a set of multiple-choice questions on network administration helps you gain more useful knowledge before starting work in the industry. invite your reference.
- Multiple choice questions about Photoshop P14are you a fan of photoshop and often use it? so you have confidence in your ability to use photoshop? try this test with network administrator.
- Test Microsoft Excel P16when using an application regularly, you will often get used to it and handle it faster. are you confident enough about your ability to use excel? try a little test to measure your excel proficiency!
- Multiple choice questions about Photoshop P15you often use photoshop. so you have confidence with your knowledge and skills for a long time. let's try a test with the network administrator on this topic.