Round 3 Quiz

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

STATE LEVEL QUIZ

COMPETITION

ROUND 3
1)Which of the following is a feature of
object-oriented programming?

A) Encapsulation
B) Compilation
C) Interpretation
D) Input/Output
2)What type of error occurs when you try to
access an index that is out of bounds in an
array?

A) Syntax error
B) Logical error
C) Runtime error
D) Compilation error
3)What will the following SQL statement return?
SELECT COUNT(*) FROM employees WHERE department = 'Sales';

A) The names of employees in the Sales department.


B) The number of employees in the Sales
department.
C) An error if there are no employees.
D) The list of departments.
4)A programmer encounters a "stack
overflow" error. What is a likely cause?

A) Infinite loop in the code.


B) Too much memory allocated.
C) Excessive recursive function calls
without a base case.
D) Incorrect data type used.
5)In the following C++ code, what will be printed?
#include <iostream>
using namespace std;
int main() {
int a = 5;
int b = 10;
cout << (a > b ? a : b) << endl;
return 0;}

A) 5
B) 10
C) 0
D) Error
6)In Java, what does the following code
produce?
public class Test {
public static void main(String[] args) {
int[] arr = new int[5];
System.out.println(arr[5]); }
}
A) 0
B) 5
C) ArrayIndexOutOfBoundsException
D) Compilation error
7)What is the output of the following C code?
#include <stdio.h>
int main() {
int x = 10;
printf("%d\n", x++);
return 0;
}

A) 10
B) 11
C) Error
D) 0
8)What will the following SQL query return?

SELECT COUNT(*) FROM students WHERE grade = 'A';

A) The total number of students


B) The number of students with grade 'A'
C) An error if no students are found
D) A list of student names
9)Which of the following can cause
a logical error?

A) Syntax errors in the code


B) Uninitialized variables
C) Incorrect calculations or wrong
conditional checks
D) Memory overflow
10) If a developer sees "undefined
reference to function" error during
linking in C++, what is the most likely
cause?

A) Syntax error in the code


B) Function declared but not defined
C) Incorrect data type
D) Missing library files
11)What will the following C++ code print?
#include <iostream>
using namespace std;
int main() {
int arr[3] = {1, 2, 3};
cout << arr[3] << endl;
return 0;
}

A) 3
B) Error
C) Undefined
D) 0
12)What will be the output of the following Java code?
public class Test {
public static void main(String[] args) {
String str = "Hello";
str.concat(" World");
System.out.println(str);
}
}

A) Hello
B) Hello World
C) Error
D) HelloWorld
13)In the following C code, what kind of error is present?
#include <stdio.h>
int main() {
int x = 10;
printf("%d\n", x/0);
return 0; }

A) Syntax error
B) Logical error
C) Runtime error
D) Compilation error
14)What will happen if you run the following C# code?
class Program {
static void Main() {
int[] arr = new int[3];
Console.WriteLine(arr[3]);
}}

A) 0
B) 3
C) IndexOutOfRangeException
D) Compilation error
15) What type of error does the
following SQL statement produce?
INSERT INTO employees (id,
name) VALUES (1, 'John'), (1,
'Doe');

A) Unique constraint violation


B) Syntax error
C) No error
D) Type mismatch error

You might also like