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;
}
C- arrays , pointers and functions and macros MCQs
Quiz
•
Professional Development
•
University
•
Hard
Shaik Imam
Used 11+ times
FREE Resource
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
22 questions
Vapor Power Cycle
Quiz
•
University
16 questions
New DRAFT
Quiz
•
University
16 questions
UC_TM03_Arrays_Functions
Quiz
•
University - Professi...
20 questions
Python Code
Quiz
•
8th Grade - Professio...
18 questions
Java Como Programar - Deitel - Cap 1 e 2
Quiz
•
University
25 questions
Python-Loops-Iterables
Quiz
•
12th Grade - University
25 questions
Topic 1: Introduction to Java Programming
Quiz
•
University
20 questions
Q1. Mixed Signals and Sensors
Quiz
•
University
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