Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Exam (elaborations)

VM1602 VARIABLES AND DATA TYPES

Rating
-
Sold
-
Pages
1
Grade
A+
Uploaded on
22-04-2025
Written in
2024/2025

VM1602 VARIABLES AND DATA TYPES

Institution
Programming
Course
Programming

Content preview

Exam: Variables and Data Types
Instructions: Answer all questions. Each question tests your understanding of variables and
data types in programming.

1. What is a variable in programming?
Answer: A variable is a named storage that can hold a value which can be changed#$%^&*(
during
the execution of a program. *&^%
2. What are the common data types in Python?
Answer: Common data types in Python include int, float, str, bool, list, tuple, set, and dict.

3. What is the difference between an integer and a float?
Answer: An integer (int) is a whole number without a decimal point, while a float is a
number that includes a decimal point.

4. How do you declare a string variable in Python?
Answer: You declare a string variable by assigning a sequence of characters enclosed in
quotes to a variable. For example: name = 'Alice'

5. What is the output of the following code: x = 5; y = '5'; print(x + int(y))?
Answer: The output is 10. The string '5' is converted to an integer before addition.

6. What is a boolean data type and what values can it hold?
Answer: A boolean data type can hold only two values: True or False.

7. Explain the difference between a list and a tuple.
Answer: A list is mutable, meaning its elements can be changed, while a tuple is immutable
and cannot be changed after creation.

8. What will be the type of variable x if we write: x = 3.14?
Answer: The type of x will be float.

9. How can you find out the type of a variable in Python?
Answer: You can use the type() function. For example: type(x)

10. Can variable names start with a number in Python? Explain.
Answer: No, variable names cannot start with a number. They must begin with a letter or an
underscore.

Written for

Institution
Programming
Course
Programming

Document information

Uploaded on
April 22, 2025
Number of pages
1
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

R320,33
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
QuickFixer Self
Follow You need to be logged in order to follow users or courses
Sold
2070
Member since
2 year
Number of followers
7
Documents
1210
Last sold
1 month ago

3,6

18 reviews

5
6
4
3
3
6
2
1
1
2

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions