#include <stdio.h>
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
}
C -Program Test-VAC-28.10.23
Quiz
•
Computers
•
University
•
Hard
Vasu Devan
Used 1+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
}
The compiler will flag an error
Program will compile and print the output 5
Program will compile and print the ASCII value of 5
Program will compile and print FAIL for 5 times
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
int main()
{
printf("%d ", 1);
l1:l2:
printf("%d ", 2);
printf("%d\n", 3);
}
Compilation error
123
12
13
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The format identifier ‘%i’ is also used for _____ data type?
char
int
float
double
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
int main()
{
enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};
printf("PEACH = %d\n", PEACH);
}
PEACH = 3
PEACH = 4
PEACH = 5
PEACH = 6
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
. #include <stdio.h>
void main()
{
float x = 0.1;
if (x == 0.1)
printf("Sanfoundry");
else
printf("Advanced C Classes");
}
Advanced C Classes
Sanfoundry
Run time error
compile time error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
void main()
{
float x;
int y;
printf("enter two numbers \n", x);
scanf("%f %f", &x, &y);
printf("%f, %d", x, y);
}
a) 7.000000, 7
b) Run time error
c) 7.000000, junk
d) Varies
7.000000, 7
Run time error
7.000000, junk
Varies
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
#include <stdio.h>
void main()
{
int x = 97;
char y = x;
printf("%c\n", y);
}
a) a
b) b
c) 97
d) Run time error
a
b
97
Run time error
30 questions
C-Programming
Quiz
•
University
25 questions
Programming Skills C/C++
Quiz
•
University
20 questions
TECHFEST QUALIFYING ROUND
Quiz
•
University
25 questions
C Quiz 1
Quiz
•
University
20 questions
Computer Fundamental and C Programming Concept
Quiz
•
University
25 questions
Code Carnival
Quiz
•
University
25 questions
Aptitude Competition(FY)
Quiz
•
University
20 questions
Pointers
Quiz
•
University
10 questions
Chains by Laurie Halse Anderson Chapters 1-3 Quiz
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
12 questions
Multiplying Fractions
Quiz
•
6th Grade
30 questions
Biology Regents Review #1
Quiz
•
9th Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
50 questions
Biology Regents Review: Structure & Function
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University
16 questions
Chapter 8 - Getting Along with your Supervisor
Quiz
•
3rd Grade - Professio...
6 questions
Railroad Operations and Classifications Quiz
Quiz
•
University
71 questions
Logos
Quiz
•
3rd Grade - University
8 questions
Mali - Geography
Quiz
•
University