Quiz Questions With Answers

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

• Quiz Questions with Answers

1. What is the output of the following code snippet?

------------------------

x=5

y=2

print(x ** y)

-------------------------

a) 10
b) 25
c) 7
d) 32

Answer: b) 25

2. Which tag is used to define an unordered list in HTML?

a) <ul>
b) <ol>
c) <li>
d) <ulist>

Answer: a) <ul>

3. What does CSS stand for?

a) Creative Style Sheets


b) Cascading Style Sheets
c) Computer Style Sheets
d) Colorful Style Sheets

Answer: b) Cascading Style Sheets

4. What is the correct way to declare a function in C?

a) int function_name() {}
b) function function_name() {}
c) void function_name() {}
d) function_name() {}
Answer: c) void function_name() {}

5. Which of the following is NOT a valid way to comment in Python?

a) // This is a comment
b) # This is a comment
c) ''' This is a comment '''
d) /* This is a comment */

Answer: a) // This is a comment

6. Which tag is used to create a hyperlink in HTML?

a) <link>
b) <a>
c) <hlink>
d) <hyper>

Answer: b) <a>

7. Which tag is used to define the header for a table in HTML?

a) <th>
b) <tr>
c) <thead>
d) <header>

Answer: a) <th>

8. What will be the output of the following code?

--------------------------------------

my_list = [1, 2, 3, 4, 5]

print(my_list[2:4])

--------------------------------------

a) [1, 2]
b) [2, 3]
c) [3, 4]
d) [4, 5]

Answer: c) [3, 4]
9. What's the distinction between '==' and 'is' operators in Python?

a) '==' compares values, 'is' checks identity

b) '==' checks identity, 'is' compares values

c) Both '==' and 'is' compare values

d) Both '==' and 'is' check identity

Answer: a) '==' compares values, 'is' checks identity

10. Which operator is used to access the value stored in a pointer variable in C? a) .
b) *
c) ->
d) ::

Answer: b) *

11. What does the “typeof” operator return in JavaScript?

a) The type of a variable


b) The value of a variable
c) The size of a variable
d) The name of a variable

Answer: a) The type of a variable

12. How can you open a link in a new browser window?

a)_blank

b) Target

c) Same

d) Open

Answer: a) _blank

13. Select the property that is used to create spacing between HTML elements?

a) margin

b) spacing

c) padding
d) border

Answer: c) padding

14. In CSS, Select the property used to set the spacing between lines of text?

a) line-spacing

b) letter-spacing

c) line-height

d) spacing

Answer: c) line-height

15. What does the function re.match do?

a) such a function does not exist

b) matches a pattern at any position in the string

c) none of the above

d) matches a pattern at the start of the string

Answer: d) matches a pattern at the start of the string

16. Which function does in-place reversal of objects in a list?

a) list.pop(obj=list[-1])

b) list.sort([func])

c) list.reverse()

d) list.remove(obj)

Answer: c) list.reverse()

17. Which of the following functions print the output to the console?

a) console.log

b) print

c) output

d) echo
Answer: a) console.log

18. What would be the result of the following expression in Python?

print 3/5

a) 0
b) None of the above
c) 0.6
d) 6/10

Answer: c) 0.6

19. Who is the father of C Language? a) Bjarne Stroustrup


b) Dennis Ritchie
c) Dr. E.F. Codd
d) James A. Gosling

Answer: b) Dennis Ritchie

20. Which of the following is not a derived data type in C? a) Function


b) Pointer
c) Array
d) Enumeration

Answer: a) Function

You might also like