0% found this document useful (0 votes)
58 views

C Language 2018

The document contains a sample exam for an introduction to C language course. It includes 10 multiple choice questions testing concepts like data types, operators, loops, functions etc. It also includes 10 true/false statements, 10 matching questions, and asks the student to answer 4 out of 8 programming questions. The programming questions cover topics like arrays, functions, strings, matrices and more. The document provides the answers to the multiple choice and true/false sections.

Uploaded by

asmit
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)
58 views

C Language 2018

The document contains a sample exam for an introduction to C language course. It includes 10 multiple choice questions testing concepts like data types, operators, loops, functions etc. It also includes 10 true/false statements, 10 matching questions, and asks the student to answer 4 out of 8 programming questions. The programming questions cover topics like arrays, functions, strings, matrices and more. The document provides the answers to the multiple choice and true/false sections.

Uploaded by

asmit
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/ 6

www.samparkcomputers.

com 2018 JAN

Introduction to C Language (M3-R4-01-18)


1. Each question below gives a multiple choice of answers. Choose the most
appropriate one and enter in “OMR” answer sheet supplied with the question paper,
following instructions therein.

1.1 What will be output if you compile and execute the following „C‟ code
void main()
{
float a=5.2;
if(a==5.2)
printf(“equal”);
else if(a<5.2)
printf(“less than”);
else
printf(“greater than”);
}
A) Equal B) Less than
C) Greater than D) Compilation Error
1.2 What will be output if you compile and execute the following „C‟ code?
void main()
{
int i=4,x;
x=++i+++i+++i;
printf(“%d”,x);
}
A) 21 B) 18
C) 12 D) Compilation error
1.3 The following code for(;;) represents as infinite loop. It can be terminated by
A) Break B) Exit(0);
C) Abort(); D) All of the mentioned.
1.4 Arguments that take input by user before running a program are called
A) Main function arguments B) Main arguments
C) Command-line arguments D) Parameterized arguments
1.5 Automatic variables are allocated memory in:
www.samparkcomputers.com 2018 JAN
A) Heap B) Data Segment
C) Code Segment D) Stack
1.6 End of file is detected by
A) fend() B) endf()
C) EOF D) FEND
1.7 If the first string and the second string both are identical, then strcmp function returns:
A) A value of 0 B) Either 1 or 0
C) A value of 1 D) Any positive integer
1.8 Register variable are active
A) Outside the function B) Throughout the program
C) Only in the function where it is defined D) Surrounding of that function
1.9 What will be the output of following program?
#include
main()
{
int x,y=10;
x=y*null;
printf(“\n %d \n”,x);
}
A) Error B) 0
C) 10 D) Garbage Value
1.10 What is the output of this code
#include<stdio.h>
void main()
{
static int x;
if(x++<2)
main();
}
A) Infinite calls to main B) Run time error
C) Varies D) Main is called twice

Answers
www.samparkcomputers.com 2018 JAN
1.1 – (A ) 1.2 – (A ) 1.3 – ( D ) 1.4 –( C) 1.5 – (D )
1.6 – ( C ) 1.7 – ( A ) 1.8 – (C ) 1.9 – (D ) 1.10- (D )

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one
and enter your choice in the “OMR” answer sheet supplied with the question paper,
following instructions therein.

2.1 Are the expression *ptr++ and ++*ptr are same?


2.2 3+=3; evaluates to 6
2.3 The default precision for printing of floating point values is 6. If the floating point
number is more precise than 6 digits, it will be rounded.
2.4 The following block of code sums up an input series of grades (terminated by -1)
while (grade !=-1);
total=total+grade;
counter=counter+1;
printf ”enter grade, -1 to end:”);
scanf(“%d”,&grade);
2.5 A double data type number uses 64 bit giving a precision of 14 digits
2.6. Every c program must have atleast one main() function section
2.7 The precedence of arithmetic operators is (from highest to lowest) %,*,/,+,-
2.8 Is the following statement valid in C?
int my_num=100,000;
2.9 void (*ptr)(int); ptr is pointer to int that converts its type to void
2.10 We need to recompile the program before executing it even if there is no change in
the source code.

Answers

2.1 – TRUE 2.2 – FALSE 2.3 – FALSE 2.4 – FALSE 2.5 – TRUE
2.6 – TRUE 2.7 – TRUE 2.8 – FALSE 2.9 – FALSE 2.10- FALSE

3. Math words and phrases in column X with the closest related meaning/words/
phrases(s) in column „Y‟. Enter your selection in the “OMR” answer sheet supplied
with the question paper, following instructions herein

X Y
3.1 In C size of data type varies from A. Char
compiler to compiler. In turboc 3.0 (16
bit compilers) size of double is _______
www.samparkcomputers.com 2018 JAN
byte
3.2 __________ is ternary operator B. 5
3.3 _____ is integral data type C. Break;
3.4 What will be the outpur when you D. True
execute following „C‟ code

#include<stdio.h>
void main()
{ char arr[7]=”network”;
printf(“%s”,arr);
}

3.5 What will be output when you will E. 10


execute following „C‟ code?
#include<stdio.h>
void main()
{
char
data[2][3][2]={0,1,2,3,4,5,6,7,8,9,10,11};
printf(“%O”,data[0][2][1]);
}
3.6 What will be output of the following „C‟ F. continue
program ?

#include<stdio.h>
int main()
{
struct s1;
int a;
}

struct s b={10};
printf(“%d”,b.s);
return 0;
}
3.7 ______ can be used out of Recursion G. Garbage Value
3.8 All the static variables are automatically H. ?:
initialized to zero
3.9 Character constants are coded using I. 8
double quotes
3.10 _______ is used to skip some J. Return
statement in a loop for that iteration
K. False
L. NULL
M. **
**

Answers

3.1 – ( I ) 3.2 – (H ) 3.3 – ( A ) 3.4 – (G ) 3.5 – ( E )


3.6 – ( L ) 3.7 – ( C ) 3.8 – (D ) 3.9 – ( K ) 3.10- (F )
www.samparkcomputers.com 2018 JAN

4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in
the list below. Choose the most appropriate option, enter your choice in the “OMR”
answer sheet supplied with the question paper, following instructions therein.

A. realloc() B. || C. gets()
D. // E. extern F. wild
G. macro H. malloc() I strrchr()
J /* K \ L dangling
M type conversion

4.1 A single line comment in C language source code can begin with ________
4.2 _________ is a logical OR operator
4.3 ________ int fun(); - the declaration indicates the presence of a global function
defined outside the current module or in another file.
4.4 ________ function that is most appropriate for reading in a multi-word string.
4.5 ________ operator is used to continue the definition of macro in the next line.
4.6. ________ is a inbuilt library function to adjust the allocated dynamic memory size
4.7 The library function ________ find the first occurrence of a substring in the string
4.8 #define allow us to define ___________
4.9 ________ is a way to promote from lower to higher data type
4.10 A pointer in C which has not been initialized is known as _________ pointer.

Answers

4.1 – (D ) 4.2 – ( B ) 4.3 – ( E ) 4.4 – (C ) 4.5 – (K )


4.6 – ( A) 4.7 – ( I ) 4.8 – ( G ) 4.9 – (M ) 4.10- ( F )
www.samparkcomputers.com 2018 JAN

Answer any Four Questions

5.

a) Write a C Program to swap two variables without using third variable

b) What are Merits and Demerits of Array in C

c) Write a C program in which a scanf() function can read a complete paragraph of text

6.

a) What is a difference between pass by value and pass by reference?

b) Write a funtion in C to print event numbers from 1 to 100

c) Write a C program to find whether a number is palindrome or not?

7.

a) Write a program to reverse an array of numbers

b) Define array and link list. Give one example for each showing its usage.

c) Write a program to delete an element from a given location of an array of integers

8.

a) Write a C program to find sum of lower triangular elements on matrix

b) Write a C program to find substring of string without using library functions.

c) How can you create your own header file in C programming ?. Briefly Explain

9. Write any three of the following questions

a) Write a C program to read following details of 50 students.


Student Name,, Student Roll No, Class

Display total number of students studying in Class “BCA”

b) Write two main differences between structure and union.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy