Hitha C Quiz 1 Continue

Hitha C Quiz 1 Continue

Professional Development

99 Qs

quiz-placeholder

Similar activities

quiz

quiz

KG - Professional Development

100 Qs

spanish words

spanish words

KG - Professional Development

94 Qs

mecatrónica automotriz

mecatrónica automotriz

Professional Development

100 Qs

On The Job Training RBB PG 2025

On The Job Training RBB PG 2025

Professional Development

100 Qs

Missouri FFA Knowledge

Missouri FFA Knowledge

Professional Development

100 Qs

REACTIVE

REACTIVE

Professional Development

103 Qs

EMS103 CHAP 32-36

EMS103 CHAP 32-36

Professional Development

100 Qs

NHN EXAM I

NHN EXAM I

Professional Development

94 Qs

Hitha C Quiz 1 Continue

Hitha C Quiz 1 Continue

Assessment

Quiz

Other

Professional Development

Hard

Created by

Lebara 2023

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

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

99 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

A variable declared inside the `main()` function can be accessed directly from another function `my_func()`. Is this true or false?
True
FALSE
Only if `my_func()` is called by `main()`
Only if passed as an argument

Answer explanation

Variables declared inside a function have local scope and are not accessible outside that function unless explicitly passed.

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which type of variable has its lifetime restricted to the block in which it is declared?
Global variable
Static variable
Local variable
External variable

Answer explanation

Local variables are created upon entry to their block and destroyed upon exit.

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

If a function `foo()` declares a local variable `x`, and another function `bar()` also declares a local variable `x`, are these two variables the same?
Yes, they refer to the same memory location
No, they are distinct variables in different scopes
Only if `foo()` calls `bar()`
Only if `x` is also a global variable

Answer explanation

Local variables with the same name in different functions are completely independent.

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What happens if you try to access a local variable outside its defined scope?
Compiler error
Runtime error
Undefined behavior
It will be initialized to zero

Answer explanation

The compiler will generate an error because the variable is not visible outside its scope.

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Where are global variables typically declared in a C program?
Inside a function
Inside the `main()` function only
Outside of any function, usually at the beginning of the source file
In a header file only

Answer explanation

Global variables are declared outside of any function and have file scope or external linkage.

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the default value of a global variable if it is not explicitly initialized?
Garbage value
Zero
Null
Undefined

Answer explanation

Global variables (and static variables) are automatically initialized to zero if not explicitly given a value.

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What is the storage duration of an `auto` variable?
Static storage duration
Dynamic storage duration
Automatic storage duration
Thread local storage duration

Answer explanation

`auto` variables have automatic storage duration, meaning they are created when their block is entered and destroyed when it's exited.

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?