
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
Test 2: Unity and C# Integration
Quiz
•
University
20 questions
Quiz - Microwave Tubes and Measurements.
Quiz
•
University
25 questions
CH Semana 4
Quiz
•
University
25 questions
Zion Round 1 Test Set 1
Quiz
•
University
25 questions
Normal Deviation
Quiz
•
University
16 questions
UC_TM02_C Programming Basics
Quiz
•
University - Professi...
20 questions
Cân bằng trong dung dịch nước
Quiz
•
11th Grade - University
17 questions
Q3 Predicate, Quantifiers and Rules of Inference
Quiz
•
University
Popular Resources on Wayground
8 questions
Spartan Way - Classroom Responsible
Quiz
•
9th - 12th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
14 questions
Boundaries & Healthy Relationships
Lesson
•
6th - 8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
3 questions
Integrity and Your Health
Lesson
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
9 questions
FOREST Perception
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
Discover more resources for Professional Development
20 questions
Disney Trivia
Quiz
•
University
7 questions
Fragments, Run-ons, and Complete Sentences
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
10 questions
DNA Structure and Replication: Crash Course Biology
Interactive video
•
11th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
14 questions
Ch.3_TEACHER-led
Quiz
•
University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University