How do you access the content of the pointer variable p inside the C program?

C Pointers 17May2023

Quiz
•
Computers
•
University
•
Hard
A M Abirami
Used 2+ times
FREE Resource
15 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
30 sec • 1 pt
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
# include <stdio.h>
void fun(int x)
{ x = 30; }
int main()
{
int y = 20;
fun(y);
printf("%d", y);
return 0;
}
20, as the function call uses Call by value
20, as the function call uses Call by reference
30, as the function call changes the value
Error in this code
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
# include <stdio.h>
void fun(int *ptr)
{ *ptr = 30; }
int main()
{
int y = 20;
fun(&y);
printf("%d", y);
return 0;
}
30, as the function call is by Call by reference (i.e. call by address)
30, as the function call is by Call by value
20, as the variable ptr has scope local to the function
Compile time error
4.
FILL IN THE BLANK QUESTION
1 min • 1 pt
#include <stdio.h>
int main() {
int *ptr;
int x=5;
ptr = &x;
*ptr = 0;
printf("%d\n", x);
return 0;
}
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
#include <stdio.h>
int main() {
int *ptr;
int x=0;
ptr = &x;
*ptr = 10;
printf("%d\t %d\n", x, *ptr);
return 0;
}
10 10
10 0
0 10
10 Undefined
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
#include <stdio.h>
int main() {
int *ptr;
int x=10;
ptr = &x;
printf("%d\t %d\n", x, *ptr);
*ptr += 5;
printf("%d\t %d\n", x, *ptr);
return 0;
}
10 10 15 15
10 10 10 15
10 10 15 Undefined
Error
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
#include <stdio.h>
int main() {
int *ptr;
int x=5, y;
ptr = &x;
y = x;
(*ptr)++;
printf("%d\t %d\n", x, y);
return 0;
}
6 5
5 6
Undefined 5
6 undefined
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
Coding club Summit Online Quiz

Quiz
•
University
20 questions
Pointers

Quiz
•
University
15 questions
Milking Minds 2 17-01-24

Quiz
•
University
13 questions
C programming-1

Quiz
•
University
10 questions
Basics Of C Programming

Quiz
•
University
15 questions
C programming

Quiz
•
University
15 questions
C Language Quiz-1

Quiz
•
University - Professi...
10 questions
C - Pointers

Quiz
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade