Font size
WorksheetsC Prog BCA 1st
Total questions: 65
Worksheet time: 50mins
1. What will be the output of the following C code?
No Output
TESTING
Compiler error
None of the above
What will be the output of the C code?
Hello World! x;
Hello World! followed by a junk value
Compile time error
Hello World!
The format identifier ‘%i’ is also used for _____ data type.
char
int
float
double
What will be the output of the following C code?
2
8
9
10
What will be the output of the following C code?
3 2 3
2 2 3
3 2 2
2 3 3
What will be the output of the following C code?
Run time error
7
8
Depends on compiler
Assuming, integer is 2 byte, What will be the output of the program?
ffff
0
8fff
Error
Who is the father of C language?
Steve Jobs
James Gosling
Dennis Ritchie
Rasmus Lerdorf
All keywords in C are in ____________
LowerCase letters
UpperCase letters
CamelCase letters
all of them
Which keyword is used to prevent any changes in the variable within a C program?
variable
mutable
constant
extern
What is #include <stdio.h>?
Preprocessor directive
Inclusion directive
File inclusion directive
None of the mentioned
scanf() is a predefined function in______header file.
stdlib. h
conio.h
stdio.h
math.h
what will be the output of the following code?
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
Compile time error
Hello World! 34
Hello World! 1000
Hello World! followed by a junk value
format specifier for float data type is (a)
What will be the final value of x in the following C code?
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
3.74
24
25
none of te above
what is the right way to initialize the array?
int num[6] = { 2, 4, 12, 5, 45, 5 };
int n{} = { 2, 4, 12, 5, 45, 5 };
int n{6} = { 2, 4, 12 };
all of the above
Which of the following correctly shows the hierarchy of arithmetic operations in C?
/ + * -
* - / +
+ - / *
/ * + -
To print out 'a' as an integer and 'b' as a decimal, which of the following printf() statement will you use?
printf("%f %lf", a, b)
printf("%f %f", a, b)
printf("%d %f", a, b)
printf("%f %d", a, b)
Which of the following is not logical operator?
&
&&
||
!
When does the code block following while(x<100) execute?
When x is less than one hundred
When x is greater than one hundred
When x is equal to one hundred
while it wishes
Input/output function prototypes and macros are defined in which header file?
conio.h
stdlib.h
stdio.h
dos.h
Which of the following is not a correct variable type?
int
real
float
char
Which of the following is the correct operator to compare two variables?
equal
=
:=
==
What is the only function all C programs must contain?
start()
system()
main()
Program()
What punctuation is used to signal the beginning and end of code blocks?
{ }
-> and <-
BEGIN and END
( and )
The "\n" character does which of the following operations?
Double line spacing
Character deletion
Character backspace
Places cursor on the next line
Is the syntax for the following C statement correct?:
scanf("%d", input);
True
False
Which arithmetic operator in C returns the integer remainder of the result of dividing its first operand by its second?
%
/
\
*
The compiler ignores comments and they are not translated into machine language.
True
False
You can have more than one main function.
True
False
Which of the following are valid variable names in C?
first_name
123name
_count
#value
Which of these are basic data types in C?
int
float
char
string
Which are arithmetic operators in C?
%
/
*
+
-
Which header file is required for using printf function?
#include<math.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
Which symbols are used for single line comments in C?
//
/* message */
--
#
What is the purpose of scanf() function?
Clear screen
Exit program
Read input
Print output
Which is the correct way to declare and initialize an integer variable?
age=20
var age=20
integer age=20
int age=20
What are essential parts of a C program?
Header files
Main function
Variables
Classes
Where is semicolon (;) required in C programs?
Preprocessor directives
End of statement
Header inclusion
Function declaration
Which format specifier is used for integers in printf?
%s
%d
%f
%c
How many bytes does a char data type occupy?
2 bytes
8 bytes
4 bytes
1 byte
Which rules apply to C identifiers?
Can start with number
Can start with letter
Can contain spaces
Can use keywords
5 5
5 10
10 10
10 5
24
14
20
error
printf("%d", -5 % 2);
-1
1
-2
Compiler dependent
in which extension we need to save the program to run on c compiler.
filename.cpp
filename.c
filename.jpeg
filename.o
What is the scope of a local variable?
Within function
Within file
Entire program
Within block
Which is the format specifier for unsigned long int
%ld
%ul
%lu
%d
The instructions that tell the computer what to do and how to do it:
Hardware
Software
Input
None of the above
Using a specific system computer can convert numbers, letters, and symbols into combinations of ones and zeros. What is the name for this system?
Conversion System
Control System
Binary System
Bits and bytes system
What are the four parts of the information processing cycle?
Input, output, processing, and deleting
Input, output, processing, and storage
Input, output, processing, and printing
None of the above
There are two types of memory on the motherboard of a computer. One is known as RAM which stands for Random Access Memory. This is also known as what type of memory?
Long term memory
Short term memory
Standard access memory
ROM
Which of the following tasks should be completed to help maintain your computer system?
Start a notebook of information for your computer system
Occasionally review disk directories and delete unnecessary files
Back up files and data on a regular basis.
All of the above
Look at this series: 201, 202, 204, 207, ... What number should come next?
205
208
210
211
Look at this series: 544, 509, 474, 439, ... What number should come next?
404
414
420
445
9 16 23 30 37 44 51
59 66
56 62
58 66
58 65
54 61
In a certain code, HARYANA is written as 8197151, how is DELHI written in that code?
45389
57389
89654
12547
If in a code language. COULD is written as BNTKC and MARGIN is written as LZQFHM, how will MOULDING be written in that code?
CHMFINTK
LNKTCHMF
LNTKCHMF
NITKHCMF
In a certain code, MONKEY is written as XDJMNL. How is TIGER written in that code?
QDFHS
SDFHS
SDFHS
UJHFS
Introducing a boy, a girl said, "He is the son of the daughter of the father of my uncle." How is the boy related to the girl?
Brother
Nephew
Uncle
Son-in-law
Introducing Sonia, Aamir says, "She is the wife of only nephew of only brother of my mother." How Sonia is related to Aamir?
Wife
Sister
Sister-in-law
Data is inadequate
Direction -
Five girls are sitting on a bench to be photographed. Seema is to the left of Rani and to the right of Bindu. Mary is to the right of Rani. Reeta is between Rani and Mary.
Q. Who is in the middle of the photograph ?
Bindu
Rani
Reeta
Seema
Direction -
Five girls are sitting on a bench to be photographed. Seema is to the left of Rani and to the right of Bindu. Mary is to the right of Rani. Reeta is between Rani and Mary.
Q. Who is second from the left in photograph ?
Reeta
Mary
Bindu
Seema
