
7_sem

Quiz
•
Information Technology (IT)
•
University
•
Hard
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
Similar Resources on Wayground
30 questions
Prelim Exam - Data Structure and Algorithms - C

Quiz
•
University
30 questions
Form 4 - CSEC Information Technology Quiz

Quiz
•
10th Grade - University
30 questions
Computer Science

Quiz
•
University
30 questions
PPL (QUIZ 4) Programming Control Structures

Quiz
•
University
25 questions
THIRD ROUND BINGO

Quiz
•
University
30 questions
C-Volution (Easy 4)

Quiz
•
University
30 questions
C-Volution (Easy 2)

Quiz
•
University
30 questions
Week 7-8

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University