BCA First Semester Old Question Paper With Complete Answer and Solutions. Computer Fundamentals and Applications, TU 2018, 2019, 2020, 2021, 2022 – BCA Old Question Tribhuwan University – GenZNotes
8. Write the DOS commands to complete following tasks.
- Create sub directory theory and practical inside d:\exam\
- Create the file name marks.txt inside theory writing the content, “Theory marks in CFA”.
- Rename the file name marks.txt with CFAmarks.txt.
- Make hidden the file CFAmarks.txt.
- Search the all files with .pdf extension.
This question was asked in Tribhuwan University’s Bachelor in Computer Applications degree’s Computer Fundamentals and Applications subject from the BCA 1st semester, in the year 2018
The solution to the question mentioned above is given below with explanation of each commands:
Here are the DOS commands to complete the tasks:
- Create sub directory theory and practical inside d:\exam\
First, we need to make sure that we are inside the exam directory of the D: drive.
For that, if we are not currently under the required directory, we need to change the directory. To change the directory, we can use the cd command in MS-DOS. This command is used to change the current directory to a specific directory on the D drive. For example, cd D:\FolderName would change the current directory to FolderName on the D drive.
As we need to create a sub directory inside d:\exam, we are going to change the directory using cd command mentioning the required directory as:
cd D:\exam
Now that we have entered the exam directory inside D: drive, we will be creating 2 directories using the mkdir command. The mkdir command in MS-DOS is used to make a new directory.
To create a directory named ‘theory’, we can type mkdir space directory name like:
D:\exam>mkdir theory
Now, to create the directory named ‘practical’, we will be using the mkdir command again with the directory named practical:
D:\exam>mkdir practical
To check and ensure that the directories are created, we can use the dir command, which is used to list the directories, like:
D:\exam> dir
This command lists all the directories in the current directory, ie, D:\exam. Our new directories theory and practical are created and are currently listed. - Create the file name marks.txt inside theory writing the content, “Theory marks in CFA”.
This question tells us to create a file named marks.txt inside the new directory named ‘theory’ that we created in the previous question.
For that, let’s enter the directory named theory. To do that, we will change the current directory using the cd command as used previously.
D:\exam> cd theory
This command sets our current directory to the theory inside the D:\exam directory.
Now, we will use the echo command to write the given text in the file named marks.txt . The echo command is a versatile tool in MS-DOS for displaying messages, managing output, and controlling the behaviour of batch files.
D:\exam\theory>echo Theory marks in CFA > marks.txt
The text after the single space after the command is used to write the content in the file named marks.txt in the above example. - Rename the file name marks.txt with CFAmarks.txt.
To rename a file, we can use the ren command as follow, ren oldfile.txt newfile.txt renames oldfile.txt to newfile.txt .
D:\exam\theory>ren marks.txt CFAmarks.txt
- Make hidden the file CFAmarks.txt.
To make a file hidden, we can use the atttib command withattrib +h d:\exam\theory\CFAmarks.txt
- Search the all files with .pdf extension.
To search the files having a same file extension, we can use the findstr command in the MSDOS. The command finds the given string in the present files and lists theme.dir d:\exam /s /b | findstr /i "\.pdf$"
These commands should help you complete the specified tasks in a DOS environment.