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 P9multiple choice questions about programming help you gain more useful knowledge for yourself in the process of learning and working. there will be 10 questions for you to test your knowledge. let's start.
- Set of multiple choice questions about programming with P12the programming test questions below will provide you with useful knowledge on this topic. if you want to study programming, you should not ignore the series of programming tests of network administration.
- Set of multiple-choice questions on award-winning programming P5serializing programming tests, in the following article, readers will be able to expand their knowledge with more interesting questions. let's start.
- Set of multiple choice questions about programming with P6the following network administrators will continue to send you interesting questions about programming. if you love this topic, then try your knowledge.
- Multiple choice questions about programming with P1 prizeprogramming is the use of programming languages and tools and utilities to write code, build practical programs and applications on your computer to serve your life. the following is an invitation to test your knowledge with our following series of articles.
- Multiple choice questions about Javascript languageif you are a beginner of these programming languages, the following multiple-choice questions of network administrator will be very suitable for you to support knowledge.
- Guide to creating multiple choice questions on VnEduone of the outstanding features of vnedu is to create multiple choice questions quickly. using vnedu, teachers will not worry about test questions that are identical to multiple choice questions, can add and edit questions easily to make midterm or final exam questions, ...
- P13 programming set of multiple choice questionsyou are a fan of programming languages and want to learn more about this topic. to give you an interesting reading about programming, in this article, the network administrator will send you a good quiz about this topic. invite your reference.
- A set of JavaScript multiple-choice questions has P4 answersplease read your knowledge and multiple choice questions around the javascript topic that the network administrator has edited below. the set of questions includes 10 sentences to try.
- A set of JavaScript multiple-choice questions with P2 answerslocated in the series of tests on programming languages, in the basic knowledge test below network administrators will send you questions with javascript topics.