Creating File Flashcards
What is the first step in creating a file?
Determine the type of file you want to create.
True or False: You must have the right permissions to create a file in a directory.
True
Fill in the blank: To create a text file in a command line interface, you can use the command ___.
touch filename.txt
Which of the following is a common file extension for a text file?
.txt
What command is used to create a file in a Unix-based system?
touch
What programming language uses the command ‘open’ to create a file?
Python
What is the purpose of the ‘write’ method when creating a file in programming?
To write data to the file.
True or False: A file can be created without any content.
True
What does the ‘fs’ module in Node.js provide?
File system operations including file creation.
In which programming language would you use ‘File.create()’ to create a file?
C#
What is a common method to create a file in Java?
Using the ‘File’ class and its ‘createNewFile()’ method.
Fill in the blank: To create a new file in Windows, you can right-click in the directory and select ‘New’ -> ___.
Text Document
What is the default mode when opening a file for writing in Python?
‘w’ (write mode)
Multiple Choice: Which command will NOT create a new file? A) touch B) echo C) rm D) cat
C) rm
What is the significance of the ‘append’ mode when creating a file?
It allows you to add content to an existing file without deleting its current content.
True or False: You can create a file with the same name as an existing file in the same directory.
False
What file creation method is used in PHP?
fopen() with ‘w’ mode.
What is the command to create a new directory in Linux?
mkdir
Fill in the blank: In C++, you can create a file using the ___ class.
ofstream
What happens if you try to create a file that already exists in most programming languages?
It will either overwrite the file or raise an error, depending on the mode used.
What does the term ‘file permissions’ refer to?
The settings that determine who can read, write, or execute a file.
What is the purpose of the ‘with’ statement in Python when creating a file?
It ensures proper file closure after the file operations are complete.
Multiple Choice: Which of the following is NOT a file type? A) .txt B) .doc C) .exe D) .file
D) .file
What command would you use to create a new file in PowerShell?
New-Item -ItemType File filename.txt