WorksheetsRound1
Total questions: 25
Worksheet time: 8mins
Guess the output of following C code
int x=10;
printf(x);
10
x
no output
compile error
What will be the output of the following C code?
int a=5, b=10;
printf("%d", a+b);
15
510
5+10
compile error
Identify the output of this C code snippet:
char c='A';
printf("%c", c+1);
B
A
compile error
no output
What will be printed by the following C code?
float f=3.14;
printf("%.1f", f);
3.1
3.14
3.140
compile error
Which of the following is a valid data type in C?
String
char
boolean
list
What does the if statement do in C?
Executes a block of code repeatedly
Executes a block of code only if a specified condition is true
Exits a loop
Declares a function
What is the output of print(10 // 3) in Python?
3.33
3
3.0
4
Which of the following is not a valid loop structure in Python?
for
while
do-while
for each
What will be the output of the following C code?
int a=3, b=4, c=5;
printf("%d", a*b+c);
17
12
35
7
Which of the following is a valid way to declare a function in C?
void functionName()
functionName void()
function voidName()
void functionName[]
What will be the output of the following Python code?
print(type(5))
int
float
str
list
What will be the output of the following C code?
int x=7, y=3;
printf("%d", x/y);
2
2.33
3
compile error
What will be the output of the following Python code?
print(10 % 3)
1
3
10
0
Which is valid in Python?
do while
while condition:
#statement1
else:
#statement2
Switch
Structure
Which of the following is a correct way to use a pointer in C?
int *p;
int p*;
p int;
int &p;
Java is _____language
Complied
Interpreted
Both
None
C is ____ language
Procedural
Object-oriented
Functional
Non-Procedural
What is the purpose of the 'break' statement in C?
To exit a loop
To skip the current iteration
To terminate the program
To skip a line
Founder of C ____
Dennis M. Ritchie
J J Thomson
James Gosling
Guido van Rossum
Founder of Java ____
Dennis M. Ritchie
J J Thomson
James Gosling
Guido van Rossum
Founder of python____
Dennis M. Ritchie
J J Thomson
James Gosling
Guido van Rossum
Name of this operator( in lower case)
condition ? expression_if_true : expression_if_false;
(a)
CEO of Infosys
Salil Parekh
Narayana murthy
Sudha murthy
Vishal Sikka
Identify the output of this Python code:
print(5 ** 2)
10
25
5
compile error
What is the purpose of a struct in C?
To define a new data type that can hold multiple related variables of different types
To create a new function that can be used multiple times in a program
To allocate memory dynamically at runtime
To perform arithmetic operations on data
