Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Unit_Id Que_Text O1 O2 O3 O4

1 C Language was developed in the year _______ 1970 1975 1980 1985

1 Which is the only function all C programs must contain? start() main() printf() getch()
1 The keywords cannot be used as variable names. TRUE FALSE

1 Algorithm is the graphical representation of logic. TRUE FALSE


1 Structure is collection of dissimilar data types. TRUE FALSE
Which operator connects the structure name to its
1 member name? - <- . Both <- and .
None of the
1 Which of the following cannot be static in C? Variables Functions Structures mentioned

1 In C, sizes of an integer and a pointer must be same. TRUE FALSE


Loss in precision occurs for typecasting
1 from____________. float to double char to short float to int long to float
A fatal error will be generated if the format string is
1 ended with a white space character. TRUE FALSE

1 scanf() is a predefined function in______header file. stdlib. h stdio. h conio.h stdarg. h


1 Which is a valid typecast? a(char); char:a; (char)a; to(char, a);
Name of a Name of
Function or Name of a Structure or
1 What is an Identifier in C Language.? Variable Macros Union All the above
1 C language is a language of ? High level Low level Middle level None of these
The format identifier ‘%i’ is also used for _____ data
1 type? char int float double
typedef enum
{Mon, Tue, Wed, struct {char
typedef int Thu, Fri} name[10], int All of the
1 Which of the following is a User-defined data type? Boolean; Workdays; age}; mentioned
Depends on the Cannot be
1 What is the size of an int data type? 4 Bytes 8 Bytes system/compiler determined
char < int < double > char >
1 Which is correct with respect to size of the datatypes? char > int > float nt > char > float double int

1 Which of the datatypes have size that is variable? int struct float double
1 Which of the following is a logical AND operator? ! && || &
1 C Programming was created in Year _______ . 1976 1972 1980 1967
Many features of C were derived from an earlier
1 language called _____. BASIC PASCAL FORTRAN B
How many times below for loop will be executed
?#include<stdio.h>
int main()
{
int i=0;<br/>
for(;<br/>;<br/>)
printf("%d",i);<br/>
return 0;<br/>
1} 10 times 1 times Infinite times 0 times
Find output of the following program ?
#include<stdio.h>
int main()
{
char str[] = "Smaller";<br/>
int a = 100;<br/>
printf(a > 10 ? "Greater" : "%s", str);<br/>
return 0;<br/>
1} 100 Greater Smaller Compile Error
Guess the output of the following program :
#include<stdio.h>
int main()
{
int x = 10;<br/>
float y = 10.0;<br/>
if(x == y)
printf("x and y are equal");<br/>
else
printf("x and y are not equal");<br/>
return 0;<br/> x and y are not
1 } Compile Error Run Time Error x and y are equal equal
Nesting of if-else statements is allowed in C
1 Programming. TRUE FALSE
Continue statement is allowed inside the switch case
1 statement ? TRUE FALSE
Which of the statement we need to write , in order to
1 check any condition. exit Break If Continue

Function Entry Controlled Exit Controlled


1 For loop is _________. Controlled Loop None of these Loop Loop

1 Is it possible to run program without main() function? TRUE FALSE


Depends on
1 How many main() function we can have in our project? 1 2 No Limit Compiler
Is it true that a function may have several declaration,
1 but only one definition. TRUE FALSE
1 What is sizeof() in C? Operator Function Macro None of these
#include <stdio.h>
int main()
{
int i = 5;<br/>
i = i / 3;<br/>
printf("%d\n", i);<br/>
return 0;<br/> Implementation Compile time
2 } defined 1 3 error
What is the precedence of arithmetic operators (from
2 highest to lowest)? %, *, /, +, – %, +, /, *, – +, -, %, *, / %, +, -, *, /
Which of the following data type will throw an error on
2 modulus operation(%)? Char Short Int Float
#include <stdio.h>
void main(){
int x = 5;<br/>
if (true);<br/>
printf("hello");<br/> It will display It will throw an Nothing will be Compiler
2 } hello error displayed dependent

2 Which of the following is an invalid if-else statement? if (if (a == 1)){} if (func1 (a)){} if (a){} if ((char) a){}
all of the
2 Which datatype can accept switch statement? Int Char Long mentioned
If the user enters 1 s 3.2, what value will be returned by
the scanf()?
2 scanf("%d %f %c", &a, &b, &c);<br/> 1 2 3 no return value
What error will be generated on using incorrect
2 specifier for the datatype being read? compile error run-time error logical error no error

Control string specifies the type and format of the data


2 that has to be obtained from the keyboard. TRUE FALSE
Only character or integer can be used in switch
2 statement TRUE FALSE

2 #define is known as preprocessor compiler directive. TRUE FALSE


The ++ operator increments the operand by 1, whereas,
2 the -- operator decrements it by 1. TRUE FALSE
Two case constants within the same switch statement
2 can have the same value. TRUE FALSE
#include <stdio.h>
int main()
{
int a = 10, b = 10;<br/>
if (a = 5)
b--;<br/>
printf("%d, %d", a, b--);<br/>
2} a = 10, b = 9 a = 10, b = 8 a = 5, b = 9 a = 5, b = 8
#include <stdio.h>
int main()
{
int i = 10;<br/>
int *p = &i;<br/>
printf("%d\n", *p++);<br/>
2} 10 11 Garbage value Address of i
2 What is sizeof() in C? Operator Function Macro None of these

2 Libray function getch() belongs to which header file? stdio.h conio.h stdlib.h stdlibio.h
Which of the following ways are correct to include
2 header file in C program? #include<stdio.h> #include"stdio.h" Both A & B None of these

Which bitwise operator is suitable for turning off a


2 particular bit in a number? && & || !

Which bitwise operator is suitable for turning on a


2 particular bit in a number? && & || |
main()
{
int x = 10;<br/>
{
int x = 0;<br/>
printf("%d",x);<br/>
} Compilation
2} 10 Error 0 Undefined
int x = 10;<br/>

int main()
{
int x = 0;<br/>
printf("%d",x);<br/>
return 0;<br/> Compilation
2} 10 0 Error Undefined
Which programming language is more faster among
2 these? Java PHP C Visual Basic
What should be the output:
void main()
{
int a = 10/3;<br/>
printf("%d",a);<br/>
2} 3.33 3.2 3 0
void main(int
argc , char **
2 Which of the following is executed by Preprocess? #include<stdio.h> return 0 argv) None of above
int main()
{
int i=10;<br/>
int j=20;<br/>
int k;<br/> k=i+j;<br/>
printf("%d",k);<br/>
return 0;<br/>
}
2 Compilation Error Runtime Error 0 30
int main()
{
int x;<br/>
x=10,20,30;<br/>
printf("%d",x);<br/>
return 0;<br/>
2} 10 20 30 Compilation Error
What is output of below program?
void main()
{
int i,j;<br/>
for(i = 0,j=0;<br/>i<5;<br/>i++)
{
printf("%d%d--",i,j);<br/>
} 00--10--20--30-- Compilation 00--01--02--03--04-
2} 0--01--12--23--34-- 40-- Error -
2 The keywords cannot be used as variable names. TRUE FALSE

A do-while loop is used to ensure that the statements


3 within the loop are executed at least twice. TRUE FALSE
#include <stdio.h>
void main()
{
int i = 2;<br/>
do
{
printf("Hi");<br/>
} while (i < 2) Compile time
3 } error Hi Hi Hi None Of These
Which loop is most suitable to first perform the none of the
3 operation and then test the condition? for loop while loop do-while loop mentioned
The keyword ‘break’ cannot be simply used within
3 _________. do-while if-else for while
Which keyword is used to come out of a loop only for none of the
3 that iteration? break continue return mentioned
goto can be used to jump from main() to within a
3 function. TRUE FALSE

The C code ‘for(;<br/>;<br/>)’ represents an infinite


3 loop. It can be terminated by ___________. break exit(0) abort() terminate
Rectangular Multidimensional
3 Which of the following is not possible statically in C? Jagged Array Array Cuboidal Array Array
The correct syntax to access the member of the ith
structure in the array of structures is?
Assuming: struct temp
{
int b;<br/>
3 }s[50];<br/> s.b.[i]; s.[i].b; s.b[i]; s[i].b;

What is the correct syntax to declare a function foo() void foo(struct void foo(struct void foo(struct none of the
3 which receives an array of structure in function? *var); *var[]); var); mentioned
ptr is array of ptr is a pointer to
What does the following declaration mean? pointers to 10 an array of 10 ptr is an array of ptr is an pointer
3 int (*ptr)[10];<br/> integers integers 10 integers to array
Address of the
In C, if you pass an array as an argument to a function, Value of elements First element of last element of Base address of
3 what actually gets passed? in array the array array the array

A one-dimensional array of one-dimensional arrays is Multi-dimensional Multi-casting Two-dimensional Three-


3 called array array array dimensional array
A. Multi-
A. One- dimensional A. Uni-casting A. Multi-casting
3 An array of arrays is called dimensional array array array array
Array is an example of run time type memory
3 allocation. TRUE FALSE
int, long, float,
3 What are the Types of Arrays.? double struct, enum char All the above
3 An array Index starts with.? -1 0 1 2
all of the
3 What is an example of iteration in C? for while do-while mentioned
#include <stdio.h>
int main()
{
int i = 0, j = 0;<br/>
while (i < 5, j < 10)
{
i++;<br/>
j++;<br/>
}
printf("%d, %d\n", i, j);<br/>
3} 5,5 5,10 10,10 Syntex Error
#include <stdio.h>
void main()
{
int k = 0;<br/>
for (k)
printf("Hello");<br/> Compile time
3} error hello Nothing Varies
#include <stdio.h>
void main()
{
int k;<br/>
for (k = -3;<br/> k < -5;<br/> k++)
printf("Hello");<br/>
3} Hello Infinite hello Run time error Nothing
Only if there is Depends on the Depends on the
4 Strcat() function adds null character. space Always standard compiler
void and (char *) void, int and (char
4 What type of return-type used in String operations? void only only void and int only *) only

String operation such as strcat(s, t), strcmp(s, t), Presence of NULL Presence of new- Presence of any None of the
4 strcpy(s, t) and strlen(s) heavily rely upon. character line character escape sequence mentioned

What will be the value of var for the following C strcmp has void
4 statement? var = strcmp("Hello", "World");<br/> -1 0 1 return-type
The data structure used to implement recursive
4 function calls _____________ Array Linked list Binary tree Binary tree
4 The principle of stack is __________ First in first out First in last out Last in first out Last in last out

4 Iteration requires more system memory than recursion TRUE FALSE


Which among the given options compares atmost n int strncmp(ch, s, int strncmp(s, ch,
4 characters of string ch to string s? n) int strcmp(ch, s) n) int strcmp(s, ch)

4 Which function will you choose to join two words? strcpy() strcat() strncon() memcon()
What is the default return type if it is not specified in
4 function definition? void int double short int
4 functions can return structure in c? TRUE FALSE
4 unctions can return enumeration constants in c? TRUE FALSE

4 A function cannot be defined inside another function TRUE FALSE


Which of the following return-type cannot be used for a none of the
4 function in C? char * struct void mentioned
Functions can
Functions can return any type
Functions can return any type except array,
return any type except array, functions,
Which of the following is true about return type of Functions can except array and functions and function pointer
4 functions in C? return any type functions union and union

It is necessary to declare the type of a function in the Returns an Returns a non- Is not defined in
4 calling program if the function integer integer value the same file None of these
Template
4 A function that uses variable types is called Overloaded Function Variable function Virtual function
call by value
4 The default parameter passing mechanism is call by value call by reference result none of above

User Defined Both Library and None of the


4 What are types of Functions in C Language? Library Functions Functions User Defined above
Recursive
4 A function which calls itself is called a ___ function. Self Function Auto Function Function Static Function
"#include <stdio.h>
int main()
{
char str[10] = ""hello"";<br/>
char *p = strrchr(str, 'l');<br/>
printf(""%c\n"", *(++p));<br/>
4 }" l o e Compilation error

You might also like