7_sem

7_sem

University

30 Qs

quiz-placeholder

Similar activities

Quiz sobre Estruturas de Repetição em Programação

Quiz sobre Estruturas de Repetição em Programação

University

25 Qs

EMPTECH REVIEW 2025-2026

EMPTECH REVIEW 2025-2026

12th Grade - University

25 Qs

Chapter 1

Chapter 1

University

35 Qs

Quiz on Lesson 1 CSU3200

Quiz on Lesson 1 CSU3200

University

33 Qs

Componenti del Computer

Componenti del Computer

1st Grade - University

25 Qs

114上國一資訊期末考模擬

114上國一資訊期末考模擬

7th Grade - University

25 Qs

SAS 1 Informatika 8

SAS 1 Informatika 8

8th Grade - University

25 Qs

Seni Budaya Quiz

Seni Budaya Quiz

11th Grade - University

25 Qs

7_sem

7_sem

Assessment

Quiz

Information Technology (IT)

University

Practice Problem

Hard

Created by

AKSV AKSV

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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.

Access all questions and much more by creating a free account

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

Already have an account?