debug2Main

debug2Main

Assessment

Flashcard

Created by

Quizizz Content

Information Technology (IT)

University

Hard

Student preview

quiz-placeholder

20 questions

Show all answers

1.

FLASHCARD

Front

What does the following code print?
public class Test {
public static void main(String[] args) {
String str = "Hello";
str.concat(" World");
System.out.println(str);
} }

Back

Hello

2.

FLASHCARD

Front

What will the following C++ code output?
int main() {
char *ptr = "Hello";
ptr[0] = 'h';
cout << ptr;
return 0;
}

Back

Segmentation fault

3.

FLASHCARD

Front

What happens if we run the following Python snippet?
try:
x = 1 / 0
except ZeroDivisionError:
print("Zero error")
except: print("Other error")

Back

Zero error

4.

FLASHCARD

Front

What happens if a delete operator is used on a NULL pointer?

Back

Does nothing

5.

FLASHCARD

Front

Which of the following will cause memory leaks in C++? A) Not using delete after new, B) Using malloc() without free(), C) Assigning a new pointer without deleting the old one, D) All of the above

Back

All of the above

6.

FLASHCARD

Front

What is the issue with the following C++ code? int main() { int* ptr = new int; return 0; }

Back

Memory leak

7.

FLASHCARD

Front

What will be the output of this Python code?
def func():
print("Hello")
x = func()
print(x)

Back

Hello None

8.

FLASHCARD

Front

What is the purpose of this SQL query? SELECT department, AVG(salary) FROM Employees GROUP BY department;

Back

Groups employees by department and finds average salary.

9.

FLASHCARD

Front

What will the following C++ code output?
int main() {
char c = 255;
cout << (int)c;
return 0;
}

Back

-1

10.

FLASHCARD

Front

What is the issue with this Python code?
def func():
x = 10
print(x)

Back

NameError

Explore all questions with a free account

or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?