DSA quiz

DSA quiz

University

20 Qs

quiz-placeholder

Similar activities

Bootcamp Day 3 - Java Array

Bootcamp Day 3 - Java Array

University

15 Qs

Introduction to Java

Introduction to Java

University

25 Qs

If else

If else

University

15 Qs

1st Year quiz

1st Year quiz

University

20 Qs

C - Strings

C - Strings

University

20 Qs

JAVA - Arrays

JAVA - Arrays

University - Professional Development

15 Qs

Java Control and Loop -2

Java Control and Loop -2

University

20 Qs

Java Programming I 3

Java Programming I 3

University

17 Qs

DSA quiz

DSA quiz

Assessment

Quiz

Computers

University

Hard

Created by

JEYASARAVANAN JEYASARAVANAN

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <stdio.h>

int main() {

int a = 5;

int b = a+++a;

printf("%d", b);

return 0;

}

What happens?

Prints 11

Prints 10

Compile error

Runtime error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <iostream>

using namespace std;

int main() {

int arr[3] = {1, 2, 3};

cout << arr[3];

return 0;

}

What happens?

Prints 0

Undefined behavior (may print garbage)

Compile error

Prints 3

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <stdio.h>

int main() {

char str[5] = "Hello";

printf("%s", str);

return 0;

}

What happens?

Prints Hello

Compile error: string too long

Prints Hell

Runtime error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <iostream>

using namespace std;

int main() {

int *p = NULL;

cout << *p;

}

Prints 0

Prints garbage

Compile error

Runtime segmentation fault

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <stdio.h>

int main() {

int x = 10;

printf("%d", ++x++);

return 0;

}

Prints 12

Compile error

Prints 11

Undefined behavior

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <iostream>

using namespace std;

int main() {

string s = "abc";

s[3] = 'd';

cout << s;

}

Prints abcd

Runtime error

Prints abc

Prints garbage

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <stdio.h>

int main() {

int a = 5, b = 2;

printf("%d", a+++b);

return 0;

}

8

7

6

Compile error

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?