C++ Programing Language
1: What does C++ stand for?
A) Common Computing Programming
B) Compact Programming Language
C) C Plus Plus
D) Computerized Programming Language
Answer: C
2:Which of the following is NOT a data type in C++?
A) int
B) float
C) double
D) string
Answer: D
3:What is the syntax for declaring a variable in C++?
A) varName = value;
B) type varName;
C) varName = type;
D) type = varName;
Answer: B
4:Which of the following is NOT a type of loop in C++?
A) for loop
B) while loop
C) do-while loop
D) foreach loop
Answer: D
5:What is the purpose of the “cin” function in C++?
A) To output data to the console
B) To input data from the console
C) To create a new variable
D) To perform a mathematical calculation
Answer: B
6:What is the purpose of the “cout” function in C++?
A) To output data to the console
B) To input data from the console
C) To create a new variable
D) To perform a mathematical calculation
Answer: A
7:What is the difference between “++i” and “i++” in C++?
A) There is no difference
B) “++i” increments the value of i before it is used in an expression, while “i++” increments the value of i after it is used in an expression
C) “i++” increments the value of i before it is used in an expression, while “++i” increments the value of i after it is used in an expression
D) Both “++i” and “i++” decrement the value of i
Answer: B
8:Which of the following is NOT a comparison operator in C++?
A) <
B) >
C) <=
D) !=
Answer: D
9:What is the purpose of the “if” statement in C++?
A) To declare a new variable
B) To loop through a block of code
C) To perform a mathematical calculation
D) To conditionally execute a block of code
Answer: D
10:What is the purpose of the “else” statement in C++?
A) To execute a block of code if a condition is true
B) To execute a block of code if a condition is false
C) To declare a new variable
D) To loop through a block of code
Answer: B
11:Which of the following is NOT a logical operator in C++?
A) &&
B) ||
C) !
D) &
Answer: D
12:What is the purpose of the “switch” statement in C++?
A) To execute a block of code if a condition is true
B) To execute a block of code if a condition is false
C) To conditionally execute a block of code based on the value of a variable
D) To declare a new variable
Answer: C
13:What is the purpose of the “break” keyword in C++?
A) To exit a loop or switch statement
B) To execute a block of code
C) To conditionally execute a block of code
D) To declare a new variable
Answer: A
Visual Basic
1:Which of the following is the correct syntax for declaring a variable in Visual Basic?
A) dim variableName as dataType
B) dim dataType as variableName
C) dim variableName = dataType
D) dim dataType = variableName
Answer: A
2:Which of the following is NOT a built-in data type in Visual Basic?
A) Integer
B) Float
C) String
D) Array
Answer: D
3:What is the purpose of the “If” statement in Visual Basic?
A) To declare a new variable
B) To conditionally execute a block of code
C) To perform a mathematical calculation
D) To loop through a block of code
Answer: B
1:What is the purpose of the “Do While” loop in Visual Basic?
A) To conditionally execute a block of code
B) To loop through a block of code
C) To exit a loop or switch statement
D) To declare a new variable
Answer: B
4:Which of the following is the correct syntax for a “For Next” loop in Visual Basic?
A) For variable = start To end Step increment
B) For variable = end To start Step decrement
C) For variable = start To end Step decrement
D) For variable = end To start Step increment
Answer: A
5:What is the purpose of the “Select Case” statement in Visual Basic?
A) To execute a block of code if a condition is true
B) To execute a block of code if a condition is false
C) To conditionally execute a block of code based on the value of a variable
D) To declare a new variable
Answer: C
6:Which of the following is NOT a comparison operator in Visual Basic?
A) <
B) >
C) <=
D) <>
Answer: D
8:What is the purpose of the “Function” keyword in Visual Basic?
A) To declare a new variable
B) To create a new function
C) To conditionally execute a block of code
D) To exit a loop or switch statement
Answer: B
9:What is the purpose of the “Call” keyword in Visual Basic?
A) To declare a new variable
B) To call a function
C) To conditionally execute a block of code
D) To exit a loop or switch statement
Answer: B
10:What is the purpose of the “Sub” keyword in Visual Basic?
A) To declare a new variable
B) To create a new function
C) To conditionally execute a block of code
D) To exit a loop or switch statement
Answer: B
11:What is the purpose of the “ByRef” keyword in Visual Basic?
A) To pass a variable by reference to a function or subroutine
B) To pass a variable by value to a function or subroutine
C) To declare a new variable
D) To exit a loop or switch statement
Answer: A
12: What is the purpose of the “ByVal” keyword in Visual Basic?
A) To pass a variable by value to a function or subroutine
B) To pass a variable by reference to a function or subroutine
C) To declare a new variable
D) To exit a loop or switch statement
Answer: A
13: Which of the following is the correct syntax for a “While” loop in Visual Basic?
A) While condition
B) While condition Do
C) Do While condition
D) Do While condition Loop
Answer: C
Phython
1: What is Python?
A) A high-level programming language
B) A low-level programming language
C) A markup language
D) A scripting language
Answer: A
2: Which of the following is NOT a valid data type in Python?
A) Integer
B) String
C) Boolean
D) Real
Answer: D
3: What is the purpose of the “print” statement in Python?
A) To declare a new variable
B) To define a new function
C) To display output to the console
D) To conditionally execute a block of code
Answer: C
4: What is the purpose of the “if” statement in Python?
A) To declare a new variable
B) To conditionally execute a block of code
C) To loop through a block of code
D) To exit a loop or switch statement
Answer: B
5: Which of the following is the correct syntax for declaring a variable in Python?
A) variableName = value
B) value = variableName
C) variableName:value
D) value:variableName
Answer: A
6: What is the purpose of the “for” loop in Python?
A) To conditionally execute a block of code
B) To loop through a block of code
C) To exit a loop or switch statement
D) To declare a new variable
Answer: B
7: Which of the following is the correct syntax for a “while” loop in Python?
A) while condition:
B) while condition do:
C) do while condition:
D) do while condition loop:
Answer: A
8: What is the purpose of the “range” function in Python?
A) To define a new function
B) To conditionally execute a block of code
C) To loop through a sequence of numbers
D) To exit a loop or switch statement
Answer: C
9: Which of the following is the correct syntax for defining a function in Python?
A) function functionName()
B) functionName()
C) def functionName():
D) functionName(parameters)
Answer: C
10: What is the purpose of the “return” keyword in Python?
A) To declare a new variable
B) To exit a loop or switch statement
C) To return a value from a function
D) To display output to the console
Answer: C
11: Which of the following is the correct syntax for passing parameters to a function in Python?
A) functionName(parameter1, parameter2)
B) parameter1, parameter2 = functionName()
C) functionName() = parameter1, parameter2
D) functionName() -> parameter1, parameter2
Answer: A
12: What is the purpose of the “try-except” statement in Python?
A) To handle exceptions in code
B) To conditionally execute a block of code
C) To loop through a block of code
D) To declare a new variable
Answer: A
13: Which of the following is the correct syntax for a “foreach” loop in Python?
A) for value in sequence:
B) foreach value in sequence:
C) foreach(sequence, value):
D) for(sequence, value):
Answer: A
14: What is the purpose of the “import” statement in Python?
A) To import a module into the current script
B) To execute a block of code if a condition is true
C) To loop through a block of code
D) To declare a new variable
Answer: A