
C- arrays , pointers and functions and macros MCQs
Authored by Shaik Imam
Professional Development
University
Used 11+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output of below program:Assume that base address of arr is 2000 and size of integer
is 32 bit
#include <stdio.h>
int main()
{
int arr[5];
arr++;
printf("%u", arr);
return 0;
}
2002
2004
2020
lvalue required
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output for a 64-bit Compiler?
# include <stdio.h>
void print(int arr[])
{
int n = sizeof(arr)/sizeof(arr[0]);
int i;
for (i = 0; i < n; i++)
printf("%d ", arr[i]);
}
int main()
{
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
print(arr);
return 0;
}
1, 2, 3, 4, 5, 6, 7, 8
Compiler Error
1 2
Run Time Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output of the below program:
#include <stdio.h>
#define SIZE(arr) sizeof(arr) / sizeof(*arr)
void fun(int* arr, int n)
{
int i;
*arr += *(arr + n - 1) += 10;
}
void printArr(int* arr, int n)
{
int i;
for(i = 0; i < n; ++i)
printf("%d ", arr[i]);
}
int main()
{
int arr[] = {10, 20, 30};
int size = SIZE(arr);
fun(arr, size);
printArr(arr, size);
return 0;
}
20 30 40
20 20 40
50 20 40
Compile-time error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict output of following program
int main()
{
int i;
int arr[5] = {1};
for (i = 0; i < 5; i++)
printf("%d ", arr[i]);
return 0;
}
1 followed by four garbage values
1 0 0 0 0
1 1 1 1 1
0 0 0 0 0
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int one = 1, two = 2;
#ifdef next
one = 2;
two = 1;
#endif
printf("%d, %d", one, two);
}
2, 1
1, 2
1, 1
2, 2
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following C code?
#include<stdio.h>
void main(){
#ifndef max
printf("hello");
#endif
printf("hi");}
hellohi
hello
hi
error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
. What will be the output of the following C code?
#include<stdio.h>
#define max 100
void main(){
#if(max%10)
printf("Bye");
#endif
printf("Hi");}
error
Bye
Hi
ByeHi
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
CSS & RWD 測驗
Quiz
•
University - Professi...
20 questions
DIETOTERAPIA 1
Quiz
•
11th Grade - University
17 questions
Python 1
Quiz
•
1st Grade - University
18 questions
Physical assessment of the EENT
Quiz
•
University
20 questions
Basics of Python Programming Unit-1
Quiz
•
University - Professi...
20 questions
ROUND 1
Quiz
•
University
20 questions
Teste Java 1
Quiz
•
University
20 questions
COP Process Engineer
Quiz
•
KG - Professional Dev...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Professional Development
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
20 questions
Endocrine System
Quiz
•
University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
30 questions
W25: PSYCH 250 - Exam 2 Practice
Quiz
•
University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University
38 questions
Unit 8 Review - Absolutism & Revolution
Quiz
•
10th Grade - University