Computer Programming Tips for Beginners Mcqs 2024

- What is the correct way to start a Python script?
A)#!/usr/bin/python
B)#!/usr/bin/env python
C)// python
D) Both A and B Answer: D
- Which data type is used to store decimal numbers in most programming languages?
A) Integer
B) Float
C) Boolean
D) String Answer: B
- What does the following code print?
print("Hello, World!")
A) Hello, World!
B) “Hello, World!”
C) Error
D) None of the above
Answer: A
- Which of the following is an infinite loop in Python?
A)for i in range(10): print(i)
B)while True: print('loop')
C)if True: print('loop')
D) None of the above Answer: B
- In HTML, which tag is used for a hyperlink?
A)<link>
B)<a>
C)<href>
D)<hyper>
Answer: B
Which of the following is not a programming language?
A) Python
B) HTML
C) Java
D) C++
Answer: B
Which symbol is used to start a single-line comment in Python?
A)//
B)#
C)/*
D)<!--
Answer: B
What is the full form of IDE?
A) Integrated Development Environment
B) Internal Development Engine
C) Intelligent Development Editor
D) Integrated Data Editor
Answer: A
What doesint
stand for in programming?
A) Integer
B) Interval
C) Integration
D) Internal
Answer: A
Which of the following is a logical operator?
A)+
B)&&
C)=
D)%
Answer: B
Data Types and Variables
Which of these is an immutable data type in Python?
A) List
B) Tuple
C) Dictionary
D) Set
Answer: B
What is the correct way to declare a variable in JavaScript?
A)variable x = 10;
B)int x = 10;
C)var x = 10;
D)x := 10;
Answer: C
Which of these is not a valid variable name?
A)_var1
B)2variable
C)var_name
D)variable2
Answer: B
In Python, what is the output oftype(3.14)
?
A)int
B)float
C)double
D)str
Answer: B
Which data structure is used to store key-value pairs?
A) List
B) Tuple
C) Dictionary
D) Array
Answer: C
Control Flow
What is the output of the following code?if 5 > 3: print("Yes") else: print("No")
A) Yes
B) No
C) Error
D) None
Answer: A
What is the purpose of thebreak
statement?
A) To stop a program
B) To exit a loop prematurely
C) To skip an iteration
D) None of the above
Answer: B
Which keyword is used to skip the current iteration of a loop?
A)continue
B)break
C)exit
D)pass
Answer: A
What is the output ofrange(5)
in Python?
A) [1, 2, 3, 4, 5]
B) [0, 1, 2, 3, 4]
C) [5, 4, 3, 2, 1]
D) Error
Answer: B
Functions
What is a function in programming?
A) A variable
B) A reusable block of code
C) A data type
D) A class
Answer: B
Which keyword is used to define a function in Python?
A)def
B)function
C)fun
D)define
Answer: A
What does thereturn
statement do?
A) Terminates a loop
B) Exits the program
C) Sends back a value from a function
D) Skips an iteration
Answer: C
Which of these is a built-in Python function?
A)append()
B)sum()
C)split()
D) All of the above
Answer: D
What willlen([1, 2, 3, 4])
return in Python?
A) 3
B) 4
C) 5
D) None
Answer: B
Object-Oriented Programming
What is an object in programming?
A) A function
B) A block of memory
C) An instance of a class
D) A data type
Answer: C
Which keyword is used to create a class in Python?
A)class
B)define
C)object
D)type
Answer: A
What is inheritance in OOP?
A) Copying code
B) Deriving new classes from existing ones
C) Encapsulation
D) Polymorphism
Answer: B
Which of these is an example of a constructor in Python?
A)init()
B)__init__()
C)self()
D)class()
Answer: B
What is the purpose of theself
keyword in Python?
A) To refer to the class itself
B) To refer to the instance of the class
C) To define global variables
D) None of the above
Answer: B
Error Handling
What doestry
andexcept
do in Python?
A) Handles exceptions
B) Loops through a sequence
C) Defines functions
D) None of the above
Answer: A
What type of error occurs when a program runs but gives incorrect output?
A) Syntax Error
B) Runtime Error
C) Logical Error
D) Compilation Error
Answer: C
Which statement is used to raise exceptions in Python?
A)throw
B)raise
C)catch
D)assert
Answer: B
What is a common file extension for Python scripts?
A).java
B).py
C).txt
D).exe
Answer: B
What is the output ofint('10') + int('20')
in Python?
A)1020
B)30
C)10 + 20
D) Error
Answer: B
Advanced Concepts
Which of these is not a database management system?
A) MySQL
B) MongoDB
C) Oracle
D) Linux
Answer: D
What does SQL stand for?
A) Structured Query Language
B) Simple Query Language
C) Standard Query List
D) Structured Query List
Answer: A
What is Git used for?
A) Programming
B) Version Control
C) Testing
D) Deployment
Answer: B
Which company developed Java?
A) Microsoft
B) Sun Microsystems
C) Google
D) IBM
Answer: B
What is the full form of API?
A) Application Programming Interface
B) Applied Programming Interaction
C) Application Process Interaction
D) Automated Programming Interface
Answer: A
Let me know if you’d like these in a document or more added!
read aslo:International Center for Chemical and Biological Sciences (ICCBS) Jobs 2024