Arrays and Pointers in C

Quiz
•
Computers
•
University
•
Medium
Karen Tan
Used 17+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 10 pts
What is the syntax for declaring an array in C?
array_name = [array_size];
array_name = data_type[array_size];
array_name[array_size] = data_type;
data_type array_name[array_size];
2.
MULTIPLE CHOICE QUESTION
30 sec • 10 pts
What is the syntax for declaring a pointer in C?
int ptr;
ptr = int;
int *ptr();
int *ptr;
3.
MULTIPLE CHOICE QUESTION
30 sec • 10 pts
How is pointer arithmetic performed in C?
By dividing the pointer by an integer value
By multiplying the pointer with an integer value
By adding or subtracting an integer value to/from a pointer
By performing bitwise operations on the pointer
4.
MULTIPLE CHOICE QUESTION
30 sec • 10 pts
What is the difference between array and pointer in C?
Arrays are a fixed-size collection of elements, while pointers are variables that store memory addresses.
Arrays cannot be passed as arguments to functions, while pointers can
Arrays can only store integers, while pointers can store any data type
Arrays and pointers are the same thing
5.
MULTIPLE CHOICE QUESTION
30 sec • 10 pts
Explain the concept of passing an array to a function in C.
Passing an array to a function in C only allows access to the first element of the array
Passing an array to a function in C allows the function to work with the elements of the array.
Passing an array to a function in C is not possible
Passing an array to a function in C allows the function to modify the size of the array
6.
MULTIPLE CHOICE QUESTION
30 sec • 10 pts
How can you dynamically allocate memory for an array using pointers in C?
Use the 'realloc' function
Use the 'malloc' function
Use the 'free' function
Use the 'calloc' function
7.
MULTIPLE CHOICE QUESTION
30 sec • 10 pts
What is the purpose of the 'const' keyword in C?
To declare a constant variable that cannot be modified
To declare a variable that can only be modified within a specific function
To declare a variable that can be modified by any function
To declare a variable that can be modified by any other variable
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Introduction to Arrays

Quiz
•
KG - University
12 questions
C++ Basics (1)

Quiz
•
University
10 questions
BCSC0006 - Quiz 1 - Arrays

Quiz
•
University
10 questions
C++ Quiz

Quiz
•
University
12 questions
Chapter 2-1: Array Part 1

Quiz
•
University
10 questions
Python - Functions

Quiz
•
University
10 questions
Rapid Round 1

Quiz
•
University
13 questions
Revision 2 MCA

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

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

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

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

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University