Syntax in Python MCQs Exercise I

Ques 1 Syntax


What is a Syntax?

A A low-level language used for hardware programming.
B A compiled language primarily used for web development
C An interpreted language often used for data science and machine learning.
D A scripting language exclusively for game development.

Ques 2 Syntax


Which of the following has the correct syntax in Python?


1) int x=10 2) x=10 3) x=(int)"5" 4) x=(float)(6.1)

A 1 is correct
B 2 is correct
C 2 and 3 is correct
D 2,3 and 4 is correct

Ques 3 Syntax


Which of the following has the correct syntax in Python?


1) x=[2,4,5,6,7,8] 2) x=list[3,45,53,32,2] 3) x=list(3,4,3,3,5,3,2) 4) x=list[12,2,4,[3,4]]

A 1 is correct
B 3 is correct
C 1 and 3 is correct
D 2,3 and 4 is correct

Ques 4 Syntax


What is the maximum length of the Identifier?

A 16
B 32
C 256
D Not a fixed Length

Ques 5 Syntax


Which of the following is NOT a valid syntax to create a dictionary in Python?

A my_dict = {'key1': 'value1', 'key2': 'value2'}
B my_dict = dict(key1='value1', key2='value2')
C my_dict = dict([('key1', 'value1'), ('key2', 'value2')])
D my_dict = {'key1': 'value1', 'key2': 'value2':}