wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C++ Faili (1)

Total questions: 12

Worksheet time: 6mins

Name
Class
Date
1.

Kāda bibliotēka tiek izmantota darbībām ar failiem C++?

What header file is used for handling file operations in C++?

a)

<iostream>

b)

<fstream>

c)

<filestream>

d)

<fileio>

2.

Pēc noklusējuma visi faili tiek atvērti ____ režīmā

By default, all the files are opened in ____ mode

a)

binary

b)

text

c)

nevaru pateikt

can't say

3.

Kā atvērt failu ar nosaukumu "data.txt" rakstīšanai?

How do you open a file named "data.txt" for writing?

a)

file.open("data.txt", ios:: output);

b)

file.open("data.txt", ios::out);

c)

file.open("data.txt", ios::in);

d)

file.open("data.txt", ios::write);

4.

Kāds ir pareizais veids, kā pārbaudīt, vai fails ir veiksmīgi atvērts?

What is the correct way to check if a file is successfully opened?

a)

if (file.is_open())

b)

if (file.opened())

c)

if (file.success())

d)

if (file.available())

5.

Kā ierakstīt tekstu "Sveika, pasaule!" teksta failā?

How do you write a string "Hello, World!" to an opened text file?

a)

file << "Hello, World!";

b)

file.write("Hello, World!");

c)

file.print("Hello, World!");

d)

file.text("Hello, World!");

6.

Kāda funkcija tiek izmantota lai aizvērtu failu?

In text file handling, what function is used to close a file?

a)

file.shutdown();

b)

file.end();

c)

file.close();

d)

file.terminate();

7.

Kā pārvietot faila rādītāju uz binārā faila sākumu?

How do you move the file pointer to the beginning of a binary file?

a)

file.reset();

b)

file.moveg(0);

c)

file.seekg(0);

d)

file.position(0);

8.

Kurš no šiem nav failu atvēršanas režīms?

Which of the following is not a file-opening mode?

a)

ios::ate

b)

ios::nocreate

c)

ios::noreplace

d)

ios::truncate

9.

Kura komanda netiek izmantota darbam ar faila rādītāju?

Which of the following is not used to seek a file pointer?

a)

ios::cur

b)

ios::set

c)

ios::end

d)

ios::beg

10.

Kura funkcija tiek izmantota faila rādītāja pārvietošanai?

Which function is used to reposition the file pointer?

a)

moveg()

b)

seekg()

c)

changep()

d)

go_p()

11.

Kura funkcija tiek izmantota C++, lai iegūtu faila rādītāja pašreizējo pozīciju failā?

Which function is used in C++ to get the current position of the file pointer in a file?

a)

getp()

b)

get_pos()

c)

tellp()

d)

tell_pos()

12.

eof() tiek izmantots, lai iegūtu vai pārbaudītu

eof() is used to get

a)

file close

b)

debug report

c)

easy code review

d)

end of file