0% found this document useful (0 votes)
5 views4 pages

HTML and Python Weekly Test Questions

Uploaded by

farazchaudhary87
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

HTML and Python Weekly Test Questions

Uploaded by

farazchaudhary87
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

WEEKLY TEST # 4 Marks: ______ / 72

Name: _______________________ Time Allowed: 90 Minutes

Q1. What is the default position of HTML elements?


☐ a) fixed ☐ b) relative ☐ c) static ☐ d) absolute

Q2. Which tag is used to display an image in HTML?


☐ a) <img> ☐ b) <image> ☐ c) <pic> ☐ d) <src>

Q3. How do you create a line break in HTML?


☐ a) <break> ☐ b) <lb> ☐ c) <br> ☐ d) <ln>

Q4. Which tag defines a table row?


☐ a) <td> ☐ b) <tr> ☐ c) <th> ☐ d) <table>

Q5. What is the correct way to create a hyperlink in HTML?


☐ a) <link="url"> ☐ b) <a url="url"> ☐ c) <a href="url"> ☐
d) <href=url>

Q6. Which HTML tag is used to define a list item?


☐ a) <list> ☐ b) <li> ☐ c) <ul> ☐ d) <dl>

Q7. What is the purpose of the <title> tag in HTML?


☐ a) Displays heading on page ☐ b) Sets page title on tab ☐ c) Adds link
☐ d) Displays image caption

Q8. Which input type is used for entering an email address?


☐ a) text ☐ b) email ☐ c) textarea ☐ d) mail

Q9. Which tag is used to group elements in HTML?


☐ a) <group> ☐ b) <span> ☐ c) <div> ☐ d) <block>

Q10. What does the <meta> tag define?


☐ a) Footer info ☐ b) Page metadata ☐ c) Navigation ☐ d) Sidebar

Q11. Which symbol is used for a class selector in CSS?


☐ a) . ☐ b) # ☐ c) @ ☐ d) &

Q12. Which CSS property is used to change text color?


☐ a) font-color ☐ b) text-color ☐ c) color ☐ d) style-color
Q13. How do you apply styles to a single ID in CSS?
☐ a) .idname ☐ b) #idname ☐ c) *idname ☐ d) idname

Q14. Which property is used to add spacing inside the border?


☐ a) margin ☐ b) spacing ☐ c) padding ☐ d) border-spacing

Q15. What does text-align: center; do?


☐ a) Makes text bold ☐ b) Centers text ☐ c) Adds space ☐ d)
Aligns image

Q16. What is the default display value of a <div> tag?


☐ a) inline ☐ b) inline-block ☐ c) block ☐ d) hidden

Q17. Which property is used to make text italic in CSS?


☐ a) font-italic ☐ b) italic ☐ c) text-style ☐ d) font-
style

Q18. What does z-index control in CSS?


☐ a) font size ☐ b) stacking order ☐ c) element size ☐ d) image
border

Q19. Which is NOT a type of CSS?


☐ a) Inline ☐ b) External ☐ c) Outline ☐ d) Internal

Q20. Which value hides an element but keeps its space reserved?
☐ a) display: none ☐ b) visibility: hidden ☐ c) opacity: 0
☐ d) none

Q21. What is the correct syntax to print in Python?


☐ a) echo("Hello") ☐ b) [Link]("Hello") ☐ c) print("Hello")
☐ d) printf("Hello")

Q22. How do you insert a comment in Python?


☐ a) // ☐ b) <!-- --> ☐ c) # ☐ d) /* */

Q23. What is the correct file extension for Python files?


☐ a) .pt ☐ b) .py ☐ c) .python ☐ d) .exe

Q24. What is the output of len([10, 20, 30])?


☐ a) 2 ☐ b) 3 ☐ c) 1 ☐ d) 30

Q25. What data type is the result of: 3 > 1?


☐ a) int ☐ b) bool ☐ c) string ☐ d) float
Q26. How do you start a function in Python?
☐ a) function myFunc(): ☐ b) def myFunc(): ☐ c) fun myFunc():
☐ d) define myFunc():

Q27. What is the output of type("Hello")?


☐ a) str ☐ b) string ☐ c) text ☐ d) char

Q28. Which keyword is used to create a loop that repeats a specific number of
times?
☐ a) while ☐ b) repeat ☐ c) for ☐ d) loop

Q29. Which of the following is a list?


☐ a) (1, 2, 3) ☐ b) {1, 2, 3} ☐ c) [1, 2, 3] ☐ d) <1, 2, 3>

Q30. What is the correct way to define a dictionary?


☐ a) dict = [1,2,3] ☐ b) dict = (1,2,3) ☐ c) dict = { "a": 1,
"b": 2 } ☐ d) dict = <a=1, b=2>

Q31. Which function is used to take input from the user?


☐ a) scanf() ☐ b) input() ☐ c) get() ☐ d) read()

Q32. What is the first index of a Python list?


☐ a) 0 ☐ b) 1 ☐ c) -1 ☐ d) Undefined

Q33. How do you stop a loop in Python?


☐ a) exit ☐ b) stop ☐ c) break ☐ d) halt

Q34. What will print(2 ** 3) output?


☐ a) 6 ☐ b) 8 ☐ c) 9 ☐ d) 5

Q35. Which function is used to get the length of a list?


☐ a) count() ☐ b) length() ☐ c) size() ☐ d) len()

Q36. Which keyword is used to create a class in Python?


☐ a) object ☐ b) class ☐ c) def ☐ d) method

Q37. What is the output of bool(0)?


☐ a) True ☐ b) False ☐ c) Error ☐ d) Null

Q38. What will int("5") + 5 output?


☐ a) 55 ☐ b) 10 ☐ c) Error ☐ d) 5

Q39. What is the result of 5 // 2?


☐ a) 2.5 ☐ b) 2 ☐ c) 3 ☐ d) 2.0
Q40. Which operator is used for equality in Python?
☐ a) = ☐ b) == ☐ c) === ☐ d) equal

Q41. What is the correct way to define a list in Python?


☐ a) myList = (1, 2, 3) ☐ b) myList = [1, 2, 3] ☐ c) myList =
{1, 2, 3} ☐ d) myList = <1, 2, 3>

Q42. Which function is used to determine the length of a string in Python?


☐ a) length() ☐ b) len() ☐ c) count() ☐ d) size()

Q43. What is the correct syntax to define a function in Python?


☐ a) func myFunc(): ☐ b) define myFunc(): ☐ c) def myFunc():
☐ d) function myFunc():

Q44. What is the output of print(10 // 3) in Python?


☐ a) 3.33 ☐ b) 3 ☐ c) 3.0 ☐ d) Error

Q45. How do you take user input in Python?


☐ a) scanf() ☐ b) input() ☐ c) get() ☐ d) user_input()

Q46. Which of the following is used to include an external CSS file in HTML?
☐ a) <style src="[Link]"> ☐ b) <css link="[Link]"> ☐ c)
<link rel="stylesheet" href="[Link]"> ☐ d)
<stylesheet>[Link]</stylesheet>

Q47. Which attribute is used in HTML to uniquely identify an element?


☐ a) class ☐ b) name ☐ c) id ☐ d) element

Subjective Questions – 5 Questions

1. Write an HTML code that creates a form with input fields for name, email,
and a submit button.
2. Describe the difference between id and class in HTML and CSS. Provide
examples.
3. Explain the box model in CSS with a labeled diagram.
4. Write a Python program that takes two numbers as input and prints their
sum, difference, product, and division.
5. Explain the difference between a list, tuple, and dictionary in Python. Give
examples of each.

You might also like