Python, HTML, CSS, Javascript, Terraform Flashcards

1
Q

What is PEP 8, and why is it important?

A

PEP 8 is a set of coding guidelines for writing Python code to make it readable and consistent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you comment in Python?

A

Comments in Python are indicated by the # symbol. They are used to explain the code and make it more understandable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain the difference between list and tuple in Python.

A

Lists are mutable sequences, while tuples are immutable sequences in Python.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of the __init__ method in Python classes?

A

The __init__ method is a special method used to initialize newly created objects in a class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you handle exceptions in Python?

A

Exceptions in Python are handled using try-except blocks to prevent crashes when something goes wrong.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a virtual environment in Python, and why would you use one?

A

A virtual environment in Python is a self-contained directory that contains a Python installation and libraries specific to a project, isolating them from system-wide installations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain the difference between == and is in Python.

A

”==” checks for equality of values, while is checks for object identity in Python.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you open and read a file in Python?

A

You can open and read a file in Python using the open() function with the appropriate mode (e.g., ‘r’ for reading) and then using methods like read() to read the file contents.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is HTML, and what does it stand for?

A

HTML stands for Hypertext Markup Language, and it is used for creating the structure and content of web pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are HTML tags and attributes?

A

HTML tags are elements used to structure content, and attributes provide additional information about elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain the difference between block-level and inline elements in HTML.

A

Block-level elements start on a new line and take up the full width available, while inline elements do not start on a new line and only take up as much width as necessary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the purpose of the and tags in HTML?

A

The tag contains metadata about the document, while the tag contains the content of the document.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you create a hyperlink in HTML?

A

Hyperlinks in HTML are created using the <a> tag with the href attribute.</a>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the difference between <div> and <span> elements?</span></div>

A

<div> is a block-level container element, while <span> is an inline container element.</span></div>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you add comments in HTML?

A

Comments in HTML are written using .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Explain the difference between HTML and HTML5.

A

HTML5 is the latest version of HTML, introducing new semantic elements and features.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are semantic elements in HTML5, and why are they important?

A

Semantic elements in HTML5 provide meaning to the content, making it more understandable for both browsers and developers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How do you embed an image in HTML?

A

Images in HTML are embedded using the <img></img> tag with the src attribute specifying the image file URL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is CSS, and what does it stand for?

A

CSS stands for Cascading Style Sheets, and it is used for styling the appearance of HTML elements on web pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What are the different ways to include CSS in an HTML document?

A

CSS can be included in an HTML document using external style sheets, internal style sheets, or inline styles.

21
Q

What is the difference between margin and padding in CSS?

A

Margin is the space outside the border of an element, while padding is the space inside the border of an element.

22
Q

How do you center an element horizontally and vertically in CSS?

A

You can center an element horizontally by setting margin: auto, and vertically by using flexbox or CSS Grid.

23
Q

What is the box model in CSS?

A

The box model in CSS refers to the layout model that consists of content, padding, border, and margin.

24
Q

Explain the difference between display: block, display: inline, and display: inline-block.

A

display: block makes an element a block-level element, display: inline makes it an inline element, and display: inline-block makes it an inline-level block container.

25
Q

What is the purpose of the z-index property in CSS?

A

The z-index property in CSS controls the stacking order of positioned elements.

26
Q

How do you create a CSS class?

A

CSS classes are reusable sets of CSS declarations that can be applied to multiple HTML elements.

27
Q

What are pseudo-classes in CSS, and give an example?

A

Pseudo-classes in CSS are keywords added to selectors that specify a special state of the selected element.

28
Q

What is the difference between position: relative, position: absolute, and position: fixed?

A

position: relative positions an element relative to its normal position, position: absolute positions it relative to its containing element, and position: fixed positions it relative to the viewport.

29
Q

What is JavaScript, and what can it be used for?

A

JavaScript is a scripting language used for creating interactive web pages and web applications.

30
Q

Explain the difference between == and === in JavaScript.

A

”==” is a loose equality comparison, while === is a strict equality comparison in JavaScript.

31
Q

What are JavaScript data types?

A

JavaScript has dynamic data types including numbers, strings, booleans, objects, arrays, and functions.

32
Q

How do you declare variables in JavaScript?

A

Variables in JavaScript are declared using var, let, or const keywords.

33
Q

What is the difference between let, const, and var in JavaScript?

A

let and const are block-scoped, while var is function-scoped in JavaScript. const variables cannot be reassigned.

34
Q

How do you write comments in JavaScript?

A

Comments in JavaScript can be single-line // or multi-line /* */.

35
Q

What is the DOM (Document Object Model) in JavaScript?

A

The Document Object Model (DOM) in JavaScript is a programming interface that represents the structure of HTML and XML documents as a tree of nodes.

36
Q

What are event listeners in JavaScript?

A

Event listeners in JavaScript are used to attach functions to DOM elements, so that the functions are executed when events occur.

37
Q

What is the difference between null and undefined in JavaScript?

A

null represents the absence of value, while undefined means a variable has been declared but not assigned a value.

38
Q

How do you declare and call a function in JavaScript?

A

Functions in JavaScript are declared using the function keyword, followed by the function name and parameters.

39
Q

What is Terraform, and what is its purpose?

A

Terraform is an open-source infrastructure as code tool used for building, changing, and versioning infrastructure safely and efficiently.

40
Q

How do you declare resources in Terraform?

A

Resources in Terraform are declared using resource blocks, which define the desired state of an infrastructure object.

41
Q

What is the difference between a provider and a resource in Terraform?

A

Providers in Terraform are responsible for interacting with APIs and exposing resources for management.

42
Q

What is the state file in Terraform, and why is it important?

A

The state file in Terraform keeps track of the current state of your infrastructure and is used to plan and apply changes.

43
Q

How do you create variables in Terraform?

A

Variables in Terraform are defined using the variable block and can be used to parameterize configurations.

44
Q

What are modules in Terraform, and why would you use them?

A

Modules in Terraform are reusable packages of Terraform configurations that are used to organize and share infrastructure code.

45
Q

What is the terraform apply command used for?

A

terraform apply is used to apply the changes described in the Terraform configuration to reach the desired state.

46
Q

How do you handle sensitive data (like passwords) in Terraform?

A

Sensitive data in Terraform can be handled using sensitive input variables or using the sensitive attribute for sensitive output values.

47
Q

What is the difference between terraform plan and terraform apply?

A

terraform plan is used to create an execution plan showing what actions Terraform will take to change the infrastructure.

48
Q

How do you destroy resources created by Terraform?

A

Resources created by Terraform can be destroyed using the terraform destroy command.