#!/usr/bin/env python
# coding: utf-8
1. To what does a relative path refer?
2. What does an absolute path start with your operating system?
3. What do the functions os.getcwd() and os.chdir() do?
4. What are the . and .. folders?
5. In C:\bacon\eggs\spam.txt, which part is the dir name, and which part is the base name?
6. What are the three “mode” arguments that can be passed to the open() function?
7. What happens if an existing file is opened in write mode?
8. How do you tell the difference between read() and readlines()?
9. What data structure does a shelf value resemble?
Q.1 To what does a relative path refer?

Sol:A relative path refers to a location that is relative to a current directory. Relative paths make use of two special symbols, a dot (.) and a double-dot (..), which translate into the current directory and the parent directory. ... The current directory is sometimes referred to as the root directory.Q.2. What does an absolute path start with your operating system?

Sol: In other words,we can say that an absolute path is a complete path from start of actual file system from / directory.Q.3. What do the functions os.getcwd() and os.chdir() do?

Sol: os.getcwd(): by using this we get the location of the current working Directory
    os.chdir():Python method chdir() changes the current working directory to the given path.
Q. 4. What are the . and .. folders?

Sol:  . and .. folders are . (current folder) and .. (parent folder). Q. 5. In C:\bacon\eggs\spam.txt, which part is the dir name, and which part is the base name?
    
    
Sol: C:\bacon\eggs is the dir name, while spam.txt is the base name.Q. 6. What are the three “mode” arguments that can be passed to the open() function?

Sol: The string 'r' for read mode, 'w' for write mode, and 'a' for append modeQ. 7 What happens if an existing file is opened in write mode?

Sol: An existing file opened in write mode is erased and completely overwritten.Q. 8 How do you tell the difference between read() and readlines()?

Sol: The read() method returns the file's entire contents as a single string value. The readlines() method returns a list of strings, where each string is a line from the file's contents.

Q. 9 What data structure does a shelf value resemble?


Sol: A shelf value resembles a dictionary value; it has keys and values, along with keys() and values() methods that work similarly to the dictionary methods of the same names.

