1 What is the output of the code given below?
#include <stdio.h>
int main()
{
char ch = 'A';
printf("%d\n", ch);
return 0;
}
psuedodode capgemini
Quiz
•
Computers
•
University
•
Medium
AMAN JOLLY
Used 173+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
1 What is the output of the code given below?
#include <stdio.h>
int main()
{
char ch = 'A';
printf("%d\n", ch);
return 0;
}
A
'A'
65
97
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
2 Which of the following is not a valid declaration in C?
1.short int x;
2.signed short x;
3.short x;
4.unsigned short x;
3 and 4
1
2
All are valid
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
3 What will be the output of the following code snippet?
#include <stdio.h>
int foo(int* a, int* b)
{
int sum = *a + *b;
*b = *a;
return *a = sum - *b;
}
int main()
{
int i = 0, j = 1, k = 2, l;
l = i++ || foo(&j, &k);
printf("%d %d %d %d", i, j, k, l);
return 0;
}
1 2 1 1
1 1 2 1
1 2 2 1
1 2 2 2
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
4 What is correct about the below program?
#include
<stdio.h>
int i;
int main()
{
if (i);
else
printf("Ëlse");
return 0;
}
if block is executed.
else block is executed
It is unpredictable as i is not initialized.
Error : misplaced else
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
5 Consider the following C function
void swap ( int x, int y )
{
int tmp;
tmp = x;
x = y;
y = tmp;
}
Call swap (a, b)
Call swap (&a, &b)
swap(a, b) cannot be used as it does not return any value
swap(a, b) cannot be used as the parameters passed by value
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
6 What will be the value of s if n=127?
Read n
i=0,s=0
Function Sample(int n)
while(n>0)
r=n%l0
p=8^i
s=s+p*r
i++
n=n/10
End While
Return s;
End Function
27
187
87
120
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
7 What will be the output of the following pseudocode?
Integer n
for (n = 3; n != 0; n--)
Print n
n = n-1
end for
3 1
3 2 1
3
Infinite Loop
20 questions
TECHFEST QUALIFYING ROUND
Quiz
•
University
25 questions
C PROGRAMMING
Quiz
•
University
20 questions
Quantitative Aptitude Series
Quiz
•
University
20 questions
CSE C Section
Quiz
•
University
20 questions
C Quest 2.0
Quiz
•
University
20 questions
Programming Concepts in C
Quiz
•
University
20 questions
Code-A-Vita
Quiz
•
University
20 questions
Basic Python
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