0% found this document useful (0 votes)
704 views11 pages

ViSAI 2023-03 Exam: Puzzles & MCQs

This document contains a practice question paper for a programming exam. It has 6 puzzles and 20 multiple choice questions related to C language. The duration for the exam is 1.5 hours with the first 45 minutes for puzzles and the next 45 minutes for programming MCQs. The paper provides instructions, the puzzles and questions along with options for answers.

Uploaded by

sec20it019
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
704 views11 pages

ViSAI 2023-03 Exam: Puzzles & MCQs

This document contains a practice question paper for a programming exam. It has 6 puzzles and 20 multiple choice questions related to C language. The duration for the exam is 1.5 hours with the first 45 minutes for puzzles and the next 45 minutes for programming MCQs. The paper provides instructions, the puzzles and questions along with options for answers.

Uploaded by

sec20it019
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

)

2-
7-1

ViSAI Labs VisAI 2023-03 6

e-con Systens
Brainchild of 5 : )7
C

143114
Instructions:
Candidates are asked to fill in the required fields on the sheet attached to the answer sheet.
This question booklet carries 6 subjective Puzzle questions & 20 multiple choice questions in
Clanguage.
D o not write anything on the question paper
There is no negative marking
All answers to be written & marked in the answer sheet.
Rough sheets to be used for solving the problems and to be tied with the Answer sheet.
.The duration for completing this question paper is: 1Hr. 30 min (45 mins+ 45 mins)

Section A - Puzzles Duration: 45 minutes


l i e s

There are three people (Alex, Ben and Cody), one of whom is a knight, one a knave, and one a spy. 1
The knight always tells the truth, the knave always lies, and the spy can either lie or tell the truth.
Alex says: "Codyis a knaye." Ben says: "Alex is a knight." Cody says: "l am thespy" Who is the spy?

2. In a party attended by married couples, no husband or wife shakes each other's hands but everyone
else shakes hands exactly once. There were 180 handshakes. How many couples were at the party?

3. A man has 10 ties in his drawer: 3 blue, 3 black and 4 red. The lights are out, and he is completely in
the dark. What is the probability that the first red tie he took was in the third attempt? 2

account of his limited resources it was


4 Prem and his best girl decided to take a bus ride, but on

necessary that they should vwalk back. Now, ifthe bus goes at the rate of nine miles an hour and they me

el et the rate ofthree miles an hour, how far can they ride so that they may be back in eighthours?
2 3 (2&
5. In a village there are 100 people, from 1900 to 1999 each person has been born.In1999, Ifa person's
pk 18
age is equal to sum of his birth year. What is his birth year?

6. There are 20 pieces of bread to be divided among 20 people. A man eats 3 pieces, woman eats 2
pieces, and a child eats half piece of bread. Tell the correct combination of men, women and children
so that they are 20 people in total, and everyone gets the bread. Note that a man cannot eat less than
3 or more than 3. A woman cannot eat less than 2 or more than 2 and the child cannot eat less than
half or more than half a piece of the bread. How many women is in the group?

(96 1
19723 2

992
97 1
(GS1-1en 1| Page
180)(3
VISAI Labs VisAl 20234
e-con Systems
Brainchild of AR

Section B- Programming MCQs Duration: 45 minug


9.
7. #include<stdio.h>
int main(

char ch;
ch 'A;
printf("The letter is");
printf("%c\n", ch »= 'A' && ch «= "Z' ? ch + 'a' - 'A':ch);
printf("Now the letter is");
printf("%c\n", ch >= 'A' && ch <= "z' ? ch: ch+ 'a' - 'A');

return 0;

A. The letter is a
Now the letter is A
B. The letter is A
Now the letter is a
C. Error
D. None of above

8. #include<stdio.h>

int get();

int main()

COnst intx = get(); 20

printf("%d",
return 0;

int get()

return 20;

A. Garbage value
B. Error
C. 20
D.0

2 Page
3-03
VisAI Labs VisAI 2023-03
inutes Brainchila of
-Con Systems

9. #include <stdio.h>
void show();
int main()

#ifndef Cvv
#define CVV 199
#endif
show;
return 0;

void show()

printf("CVV=%d",CVw);

A. No output
B. CVV-0
C. CVV=199
D. Compiler error

10. What is the output of C program?


#include<stdio.h>
int main(

float a=654.123456f;
printf("%3.3f,%3.2f",a,a);
return 0;

A. 654,654
B. 654.123456,654.123456
C. 654.123,654.12
D. 654.000,654.00

3 Page
ViSAI Labs
Brainchild of R
Ee-con Systems VisAl 202
11. #include<stdio.h>
void myshow{);
int main)

myshow();
myshow();
myshow();
void myshow()

static int k=
20:
printf "%d", k};
ktt

A. 20 20 20
B. 20 21 21
C. 20 21 22
D. Compiler error.

12. #include<stdio.h>
# include <stdio.h>
void fun(int "ptr)

ptr 30;

int main()

int y = 20;

fun(&y);
printf("%d", y};
return 0;

A. 20
3. 30
C. Compiler Error
D. Runtime Error

4 Page
3- ViSAI Labs VisAI 2023-03
e-con Systems
Brainchild oft

13. #include <stdio.h>


int main()

int counter =
1;
do{
printf("%d, ", counter);
counter += 1;
while (counter >= 10);
printf("\nAfter loop counter=%d", counter);
printf("\n");
return 0;

A. After loop counter=1


B. 1,
After loop counter=2
C. 1,
After loop counter=1
D. After loop counter=2

14. #include <stdio.h>


#include <stdlib.h>
int main(0

int m = 2, c=1;

int n,a,b, limit=10;


while(c < limit)

for (int n 1; n < m; ++n)

a = m * m - n * n;

b 2 * m * n;

C m * m + n * n;

if(c> limit)
break;
printf("%d %d %d\n", a, b, c);

mt+;

5 Page
ViSAI Labs
Broinchild of
Ee-con Systems
R
VisAl 2023

A. 537
B. 257
7910
C. 123
456
789
D. 345
86 10

15. #include<stdio.h>
void fun1 char *s1, char *s2) {
char tmp;
tmp = s1;

s1 s2;
s2 tmp;

void fun2(char **s1, char **s2) {


char tmp;
tmp *s1;
*s1= *s2;
*s2 = tmp

int main (0 {
char *str1 =
"VisAI", *str2 =
"Labs";
fun1(str1, str2);
printf("%s %s ", str1, str2);
fun2(&str1, &str2);
printf("%s %s ", str1, str2);
return 0;

6 Page
-03
ViSAI Labs VisAI 2023-03
c-con Systems
Brainchild of F
A. VisAI Labs Labs VisAI
B. Labs VisAI VisAl Labs
C. Labs ViaAl Labs VisAl
D. VisAI Labs VisAl Labs

16. #include<stdio.h>
int funclint n)

int i-0;

while(n%101=0)

n=n+3
i++

n=n-i;
return n;

void main()

printf("%d",func(35);

A. 50
B. 55
C. 53
D. 45

17. #include<stdio.h>
void main (0

int a-5,b=2,c=1;
if(b>a && a>c && c>b)
b=a+1;
else
a=b+1;
printf(%d",atb+c);

7|Page
VisAl Labs VisAl 2023-
Brainchild of
Sy
e-con Systemns

A.6
B.11
C.19
D.7

18. #include <stdio.h>


int main(

float a = 5;

switch(a)
case 5: printf("econ");
default: printf("system");

return 1;

A.econ
B.systenm
C.econsystem
D.Error

19. #include<stdio.h>
int main()

int ij,count;
count=-0;
for(i=0; i<5; it+);

forlj-0;j<5j++);
{
count++;

printf("%d",count);

return 0;

8 Page
ViSAI Labs VisAI 2023-03
-on Systens
Eruinchild of

.55
B. 54
C. 1
D.0

20. What kind of


expression is "new Point (2,3)"?
A. Constructor Calling Expression
B. Invocation Expression
C. Object Creation Expression
D. Primary Expression

21. Which one of the


given options can be considered as the correct
following JavaScript code? output for the
const obj1=

a:10,
b:15,
c:18

const obj2
=Object.assign(fc:7, d:1}, obj1);
console.loglobj2.c, obj2.d);
A. Undefined
B. 18,1
C. 7,1
D. Error

22. If the following piece of JavaScript code is executed, will it work if not, what kind
of possible error can occur?
function fun(fo)

for(;o.next; oo =o.next);
return o

A. Yes, it will work fine


B. No, this will not iterate at all
C. No, it will throw an exception as only numeric's can be used in a
for loop

9Page
2023-03
VISAI Labs VisAI
e-con Systems
Cunare

Brainchild of R
use
"Cannot
message
e r r o r with
the
runtime
produce a
D. No, it will
Linked List"
stored in memory
i, j and k
are
where are
program,
23. C o n s i d e r the following

int i;
int main()

int
(sizeofint));
int *k =
(int *) malloc

*k stored in stack segment


A. i, j and are
*k is stored on heap.
stored in stack segment.
B. i andjare stack
is stored in
stored in BSS part of data segment, j
C. i is
stored on heap.
segment. *k is
stored in stack
stored in BSS part
segment, is
of data i
D.jis
segment. *k is
stored on heap.

integer and a pointer is 4 byte. Output?


24. Assume sizeof
an

#include <stdio.h>

#define R 10
#define C 20

int main(0

int ("p)[R][C;
printf("%d", sizeof(*p);
getchar();
return 0;

A. 200
B. 4

C. 800
D.880

10| P a ge
VisAI Labs VisAI 2023-03
-con Systems
Biainchild of lK
25. What is
printed by the following C program?
#include <stdio.h>
int fint x, int "py, int **ppz)
int y, z,
**ppz += 1;
Z **ppz;
py + 2,
yz*py
x+= 3;
return x+y + Z,

void main()

int c, *b, **a;


C 4
b &c;
a &b;

printf( "%d", f{c,b,a);


getchar();

A. 18
B. 19
.21
D. 22
26. What is the
meaning of using extern before function
function declaration? For example,
sum is made extern following
extern int sum(int x, int int
y, z)
return (x+y+z);

A. Function is made
globally available
B. extern means nothing, sum() is same without extern keyword.
C. Function need not to be declared before its
use
D. Function is made local to the file.

11| Page

You might also like