**Q1. a) What does a cross platform language mean?**

Cross platform language means that the language can run on different platforms like Windows, Linux, Unix, Macintosh, smartphones, etc.**b) What is a keyword?**

A keyword is a special word that has a special meaning or purpose. It is a reserved word. Example: if, else, etc.**c) Differentiate between an interpreter and a compiler.**

An interpreter converts a high-level language program into machine language by converting and executing it line by line. A compiler converts the entire high level language program in one go.**d) Out of the following, find those identifiers which cannot be used for naming a variable in a python program:****Myfile, FILE14, _BRS, Z2K89, break, bt-23, 29RSTS, assert.**

break, bt-23, 29RSTS, assert are the identifiers that cannot be used for naming variables in a python program.**e) Write the escape sequence for:****(i) Horizontal tab (TAB)**

\t**(ii) Newline character**

\n**(iii) Backslash**

\\**(iv) ASCII Bell (BELL)**

\a**f) What are comments? How to write single line comments in Python?**

Comments are the additional readable information to clarify the source code. Single line comments begin with # symbol. Example:`#this is a comment`

**Q2. a) (i) (24.6) _{8} = (?)_{10}**

20.75

_{10}

**(ii) (266)**

_{10}= (?)_{8}412

_{8}

**b) (i) (1010100.011)**

_{2}= (?)_{10}84.375

_{10}

**(ii) (106.2)**

_{10}= (?)_{2}1101010.0011

_{10}

**c) (i) (72905)**

_{10}= (?)_{16}11CC9

_{16}

**(ii) (EB4A)**

_{16}= (?)_{10}60234

_{10}

**d) (i) (11.01)**

_{2}+ (101.11)_{2}= (?)_{2}1001.00

_{2}

**(ii) (01010111)**

_{2}+ (00110101)_{2}= (?)_{2}10001100

_{2}

**e) Represent (-25)**

_{10}in 8-bit signed binary form and 2’s complement form.Signed binary form: 10011001

_{2}

2’s complement form: 11100111

_{2}

**Q3. a) Draw a flowchart to find the maximum among three numbers.**

**b) Find the output of the following code fragment:**

```
a = 49
b = math.sqrt(a)
a += b
print(a)
print(b)
```

**OUTPUT:**

56.0

7.0

**c) Write the corresponding python expressions for the following mathematical expressions:****(i) 5 – ye ^{3y} + 4y**

5 – y * e ** (3 * y) + 4 * y

**(ii) √(b**

^{2}– 4ac) / (2a)math.sqrt((b * b – 4 * a * c) / (2 * a))

**d) Find the output of the following code fragment:**

```
x, y = 2, 6
x, y = x + y, y + 0
x, y = x + 0, x - y
x, y = x - y, y + 0
print(x, y)
```

**OUTPUT:**

6 2

**e) How many ways are there in python to represent integer literals? Write their names.**

Python allows 3 types of integer literals: decimal, octal, and hexadecimal.

**Q4. a) Write a program to swap two numbers without using a third variable.**

```
a = int(input('First number: '))
b = int(input('Second number: '))
print('Initially a =', a, 'b =', b)
a, b = b, a
print('Now a =', a, 'b =', b)
```

**b) Write a program to check whether a number is a buzz number or not. A buzz number is a number which is either divisible by 7 or its last digit is 7.**

```
n = int(input("Enter the number: "))
if n % 7 == 0 or n % 10 == 7:
print(n, "is a buzz number.")
else:
print(n, "is not a buzz number.")
```

**c) Write a program to check whether a number is positive, negative or zero.**

```
n = int(input("Enter the number: "))
if n > 0:
print(n, "is positive.")
elif n == 0:
print(n, "is zero.")
else:
print(n, "is negative.")
```

**d) Write a program to enter the marks in 5 subjects for a student. Find the total marks, average marks and grade. Calculate the grade as per the following criteria:**

Average Grade

>= 80 A

60 to 79 B

50 to 59 C

< 50 D

```
math = int(input("Enter marks in math: "))
computer = int(input("Enter marks in computer: "))
physics = int(input("Enter marks in physics: "))
chemistry = int(input("Enter marks in chemistry: "))
biology = int(input("Enter marks in biology: "))
total = math + computer + physics + chemistry + biology
average = total / 5
if average >= 80:
print("Grade A")
elif average >= 60:
print("Grade B")
elif average >= 50:
print("Grade C")
else:
print("Grade D")
```

**e) Write a program to enter the measure of three sides and check whether a triangle can be formed or not.**

```
a = float(input('First side: '))
b = float(input('Second side: '))
c = float(input('Third side: '))
if a + b > c and b + c > a and c + a > b:
print('Triangle can be formed.')
else:
print('Triangle cannot be formed.')
```