7_sem

7_sem

University

30 Qs

quiz-placeholder

Similar activities

Emoji Challenge: Tech Edition

Emoji Challenge: Tech Edition

University

26 Qs

XI RPL Quizziz Pertemuan 3 XI RPL (Array dan Fungsi)

XI RPL Quizziz Pertemuan 3 XI RPL (Array dan Fungsi)

11th Grade - University

25 Qs

SAS Dasar Program Keahlian RPL Kelas X

SAS Dasar Program Keahlian RPL Kelas X

10th Grade - University

25 Qs

QUIZ 1 - INTRODUCTION IN ARDUINO AND SKETCHING IN CODE

QUIZ 1 - INTRODUCTION IN ARDUINO AND SKETCHING IN CODE

University

30 Qs

Revision Quiz 3

Revision Quiz 3

9th Grade - University

30 Qs

Remidi PTS Gasal

Remidi PTS Gasal

12th Grade - University

25 Qs

Python Programming Quiz

Python Programming Quiz

University

25 Qs

Prelims Reviewer 3 Operating Systems

Prelims Reviewer 3 Operating Systems

University

29 Qs

7_sem

7_sem

Assessment

Quiz

Information Technology (IT)

University

Hard

Created by

AKSV AKSV

Used 1+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output? int x = 10; printf("%d %d", x, x++);

10 11

11 10

Undefined behavior

10 10

Answer explanation

The expression 'x++' modifies 'x' after its current value is used. Since 'x' is evaluated twice without a sequence point, it leads to undefined behavior. Thus, the output is not predictable, making 'Undefined behavior' the correct choice.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to avoid multiple inclusions of header files?

static

extern

#pragma once

const

Answer explanation

The keyword #pragma once is used in C and C++ to prevent multiple inclusions of the same header file, ensuring that the file is included only once per compilation unit. This helps avoid redefinition errors.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? printf("%d", sizeof("Hello"));

5

6

4

Compiler error

Answer explanation

The expression sizeof("Hello") calculates the size of the string literal, which includes the null terminator. "Hello" has 5 characters plus 1 for the null terminator, totaling 6. Thus, the correct answer is 6.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which sorting has best case O(n)?

Bubble sort

Insertion sort

Merge sort

Quick sort

Answer explanation

Insertion sort has a best case time complexity of O(n) when the input array is already sorted. In this scenario, it only requires a single pass through the array, making it more efficient than the other sorting algorithms listed.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator has the highest precedence?

* (dereference)

++

()

[]

Answer explanation

The operator with the highest precedence is '()' (parentheses), which is used for grouping expressions and function calls. It takes precedence over dereference, increment, and array subscripting operators.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which storage class allows local persistence of variables?

auto

static

register

extern

Answer explanation

The 'static' storage class allows variables to maintain their value between function calls, providing local persistence. In contrast, 'auto' and 'register' do not retain values after the function exits, and 'extern' is used for global variables.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not a valid string function in standard C?

strcpy()

strcat()

strrev()

strlen()

Answer explanation

The function strrev() is not part of the standard C library. The other functions, strcpy(), strcat(), and strlen(), are valid string functions used for copying, concatenating, and measuring string length, respectively.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?