404

الصفحه التي تبحث عنها غير موجوده

Interview Questions on Fundamental of C Language set-8

0

1) The control automatically passes the first statement after the loop in ..

A. Continue statement

B. Break statement

C. Switch statement

D. If statement


2) Which of the following is a scalar data type?

A. Float

B. Union

C. Array

D. Pointer


3) The given FOR loop is ..

for( ; ; ) { printf(" "); }

A. valid

B. invalid

C. indefinite

D. displays runtime error


4) In C, a union is ......

A. memory location

B. memory store

C. memory screen

D. memory space


5) The ......... statement causes immediate exit from the loop overriding the condition test ..

A. Exit

B. Break

C. Goto

D. None of the above


6) Pointers are of ..........

A. integer data type

B. character data type

C. unsigned integer data type

D. None of these


7) The keyword used to transfer control from a function back to the calling function is ...

A. switch

B. goto

C. go back

D. return


8) Identify the invalid pointer arithmetic ......

A. addition of float value to a pointer

B. comparison of pointers that do not point to the element of the same array

C. subtracting an integer from a pointer

D. assigning the value 0 to a pointer variable


9) In C, if you pass an array as an argument to a function, what actually gets passed?

A. Value of elements in array

B. First element of the array

C. Base address of the array

D. Address of the last element of array


10) Header file in C contain ......

A. compiler commands

B. library functions

C. header information of C programs

D. operators for files

11) Which of the following cannot be checked in a switch-case statement?

A. Character

B. Integer

C. Float

D. Enum


12) The printf() function returns which value when an error occurs?

A. Positive value

B. zero

C. Negative value

D. None of these


13) When array elements are passed to a function with their values, it is called as ...

A. end value

B. call by value

C. return value

D. first value


14) Which of the following is character oriented console I/O function?

A. getchar() and putchar()

B. gets() and puts()

C. scanf() and printf()

D. fgets() and fputs()


15) In the for loop structure there are .......... optional clauses.

A. one

B. two

C. three

D. four


16) Which header file is essential for using strcmp() function?

A. string.h

B. strings.h

C. text.h

D. strcmp.h


17) A multidimensional array can be expressed in terms of ...........

A. array of pointers rather than as pointers to a group of contiguous array

B. array without the group of contiguous array

C. data type arrays

D. qualifies of data types


18) The real constant in C can be expressed in which of the following forms?

A. fractional form only

B. exponential form only

C. ASCI form only

D. Both fractional and exponential forms


19) A structure ...

A. can be read as a single entity

B. cannot be read as a single entity

C. can be displayed as a single entity

D. has member variables that cannot be read individually


20) What will the function randomize() do?

A. returns a random number

B. returns a random number generator in the specified range

C. returns a random number generator with a random value based on time

D. return a random number with a given seed value


Answers:

1) B. Break statement
2) A. Float
3) D. displays runtime error
4) C. memory screen
5) B. Break
6) D. None of these
7) D. return
8) D. assigning the value 0 to a pointer variable
9) C. Base address of the array
10) B. library functions
11) C. Float
12) C. Negative value
13) B. call by value
14) A. getchar() and putchar()
15) C. three
16) A. string.h
17) A. array of pointers rather than as pointers to a group of contiguous array
18) D. Both fractional and exponential forms
19) A. can be read as a single entity
20) C. returns a random number generator with a random value based on time


Related Posts


Solved MCQ on Fundamental of C Language set-7

0

1) 'C' allows a three way transfer of control with the help of

A. Unary Operator

B. Relational Operator

C. Ternary Operator

D. Comparison Operator


2) Operators have hierarchy. It is used to know which operator ....

A. is most important

B. is used first

C. is faster

D. operators on large numbers


3) The statement that transfers control to the beginning of the loop is called ..

A. break statement

B. exit statement

C. continue statement

D. goto statement


4) C programming language was developed by ..

A. Dennis Ritche

B. Ken Thompson

C. Bill Gates

D. Peter Norton


5) The value that follows the keyword CASE may only be

A. constants

B. variable

C. number

D. semicolon


6) In a C language 'a' represents ...

A. a digit

B. an integer

C. a character

D. a word


7) The statement which is used to terminate the control from the loop is

A. break

B. continue

C. goto

D. exit


8) The continue command cannot be used with ....

A. for

B. switch

C. do

D. while


9) A self contained block of statements that perform a coherent task of some kind is called a .

A. Monitor

B. Function

C. Program

D. Structure


10) Which among the following is a unconditional control structure?

A. do while

B. if else

C. goto

D. for


11) Recursion is sometimes called

A. Circular definition

B. Complex definition

C. Procedure

D. Union


12) Every program statement in a C program end with ...

A. semicolon

B. comma

C. full stop

D. slash


13) The loop in which the statements within the loop are executed at least once is called

A. do-while

B. while

C. for

D. goto


14) The maximum length allowed in specifying the name of a C variable is ........

A. 45

B. 31

C. 56

D. 78


15) The break statement causes an exit

A. Only from the innermost loop

B. Only from the innermost switch

C. From the innermost loop or switch

D. From the program


16) Which of the following is a unformatted console I/O function to get a string input?

A. puts

B. gets

C. clrscr

D. scanf


17) The operators << and >> are

A. assignment operator

B. relational operator

C. logical operator

D. bitwise shift operator


18) The operator & is used for ........

A. Bitwise AND

B. Bitwise OR

C. Logical AND

D. Logical OR


19) Which of the following is FALSE in C

A. Keywords can be used as variable names

B. Variable names can contain a digit

C. Variable names do not contain a blank space

D. Capital letters can be used in variable names


20) The operator && is an example of ........... operator.

A. assignment

B. increment

C. logical

D. relational


Answers:

1) C. Ternary Operator
2) B. is used first
3) C. continue statement
4) A. Dennis Ritche
5) A. constants
6) C. a character
7) A. break
8) D. while
9) B. Function
10) C. goto
11) A. Circular definition
12) A. semicolon
13) A. do-while
14) B. 31
15) C. From the innermost loop or switch
16) B. gets
17) D. bitwise shift operator
18) A. Bitwise AND
19) A. Keywords can be used as variable names
20) C. logical

Related Posts

objective type questions in c programming language set-6

0


1. Which symbol is used as a statement terminator in C?

A) !

B) ~

C) #

D) ;


2. If the size of the array is less than the number of initializes then, ..........

A) extra values are being ignored

B) generates an error message

C) size of array is increased

D) size is neglected when values are given


3. In C, if you pass an array as an argument to a function, what actually gets passed?

A) Value of elements in array

B) First element of the array

C) Base address of the array

D) Address of the last element of array


4. How many times the following loop be executed? { .. ch='b'; while (ch>='a' && ch<=='z') ch++; }

A) 0

B) 25

C) 26

D) 1


5. If a=8 and b=15 then the statement x=(a>b) ? a:b;


A) assigns a value 8 to x

B) gives an error message

C) assigns a value 15 to x

D) assigns a value 7 to x


6. What is the output of the following code. int n=0, m=1; do { printf("%d", m); m++; } while (m<=n);

A) 0

B) 2

C) 1

D) 4


7. A C program contains the following declaration int i=8, j=5 what would be the value of following expression? abs(i-2*j)
A) 2

B) 4

C) 6

D) 8


8. The output of the following is . int a=75; printf("%d%%", a);

A) 75

B) 75%%

C) 75%

D) None of the above


9. How many times the following program would print ("abc")? main( ) { printf("\nabc"); main( ); }

A) Infinite number of times

B) 32767 times

C) 65535 times

D) Till the stack does not overflow


10. Which of the following is the correct usage of conditional operators used in C?

A) a>b?c=30:c=40;

B) a>b?c=30;

C) max=a>b?a>c?a:c:b>c?b:c

D) return (a>b)?(a:b)





Answers:



1. Which symbol is used as a statement terminator in C?

D) ;

2. If the size of the array is less than the number of initializes then, ..........

B) generates an error message

3. In C, if you pass an array as an argument to a function, what actually gets passed?

C) Base address of the array

4. How many times the following loop be executed? { .. ch='b'; while (ch>='a' && ch<=='z') ch++; }

B) 25

5. If a=8 and b=15 then the statement x=(a>b) ? a:b;

C) assigns a value 15 to x

6. What is the output of the following code. int n=0, m=1; do { printf("%d", m); m++; } while (m<=n);

C) 1

7. A C program contains the following declaration int i=8, j=5 what would be the value of following expression? abs(i-2*j)
A) 2

8. The output of the following is . int a=75; printf("%d%%", a);

D) None of the above

9. How many times the following program would print ("abc")? main( ) { printf("\nabc"); main( ); }

A) Infinite number of times

10. Which of the following is the correct usage of conditional operators used in C?

C) max=a>b?a>c?a:c:b>c?b:c




Related Posts

 

Solved MCQ on C Programming Language set-5

0

1. What will be output of the following C program? #include int main() {int goto=5; printf("%d",goto); return 0;}

A) 5

B) 10

C) **

D) compilation error


2. Output of the following C program fragment is. x=5; y=x++; printf("%d %d", x,y);

A) 5, 6

B) 5, 5

C) 6, 5

D) 6, 6


3. What will be output of the following C program? #include int xyz=10; int main() { int xyz=20; printf("%d", xyz); return 0;}

A) 10

B) 20

C) 30

D) compilation error


4. Following program fragment. main(){ printf("%p\n", main( ) ); }

A) Prints the address of main function

B) Prints 0

C) Is an error

D) In an infinite loop


5. What will be output of the following program? #include int main() {int a=2, b=7, c=10; c=a==b; printf("%d",c); return 0;}

A) 0

B) 7

C) 10

D) 2


6. What is the output of the following program segment? main( ) { long i=65536; printf("%d\n", i); }

A) 0

B) 65536

C) -1

D) 65


7. What will be the output of the program? # include int main() {int a[5]={5,1,15,20,25}; int i, j, m; i=++a[1]; j=a[1]++; m=a[i++]; printf("%d, %d, %d", i,j,m); return0;}

A) 2, 1, 15

B) 1, 2, 5

C) 3, 2, 15

D) 2, 3, 20


8. What is the output of the following program segment? main( ) { int=1; do { printf("%d . . ", i); } while (i--); }

A) 0 . . 1 . .

B) 1 . . 0 . .

C) 0

D) -1


9. Output of the program below is. int i; main( ) { printf("%d", i); }

A) 1

B) 0

C) -1

D) Null


10. What will be the output of the following program? main( ) { int i=5; printf("%d", i=++i==6); }

A) 0

B) 7

C) 6

D) 1




Answers:




1. What will be output of the following C program? #include int main() {int goto=5; printf("%d",goto); return 0;}

A) 5

2. Output of the following C program fragment is. x=5; y=x++; printf("%d %d", x,y);

C) 6, 5

3. What will be output of the following C program? #include int xyz=10; int main() { int xyz=20; printf("%d", xyz); return 0;}

B) 20

4. Following program fragment. main(){ printf("%p\n", main( ) ); }

A) Prints the address of main function

5. What will be output of the following program? #include int main() {int a=2, b=7, c=10; c=a==b; printf("%d",c); return 0;}

A) 0

6. What is the output of the following program segment? main( ) { long i=65536; printf("%d\n", i); }

A) 0

7. What will be the output of the program? # include int main() {int a[5]={5,1,15,20,25}; int i, j, m; i=++a[1]; j=a[1]++; m=a[i++]; printf("%d, %d, %d", i,j,m); return0;}

C) 3, 2, 15

8. What is the output of the following program segment? main( ) { int=1; do { printf("%d . . ", i); } while (i--); }

B) 1 . . 0 . .

9. Output of the program below is. int i; main( ) { printf("%d", i); }

B) 0

10. What will be the output of the following program? main( ) { int i=5; printf("%d", i=++i==6); }

D) 1



Related Posts

 

MCQ on C Programming With Answers set-4

0

1. 'C' is often called a ....

A) Object oriented language

B) High level language

C) Assembly language

D) Machine level language


2. Each C preprocessor directive begins with ....

A) #

B) include

C) main()

D) {


3. C allows arrays of greater than two dimensions, who will determine this?

A) programmer

B) compiler

C) parameter

D) None of the above


4. The << operator is used for

A) Right shifting

B) Left shifting

C) Bitwise shifting

D) Bitwise complement


5. Set of values of the same type, which have a single name followed by an index is called

A) function

B) structure

C) array

D) union


6. Which of the following header file is required for strcpy() function?

A) String.h

B) Strings.h

C) file.h

D) strcpy()


7. scanf() can be used for reading ...

A) double character

B) single character

C) multiple characters

D) no character


8. A variable which is visible only in the function in which it is defined is called

A) Static variable

B) auto variable

C) external variable

D) local variable


9. In the loop structure logical expression is checked at the ....................of the loop.

A) first

B) end

C) middle

D) second


10. If an array is used as function argument, the array is passed

A) by value

B) by reference

C) by name

D) the array cannot be used as function argument


11. If is necessary to declare the type of function in the calling program if

A) Function returns an integer

B) Function returns a non-integer value

C) Function is not defined in the same file

D) Function is called number of times


12. Which escape character can be used to begin a new line in C ........

A) \a

B) \m

C) \b

D) \n


13. Input/output function prototypes and macros are defined in which header file?

A) conio.h

B) stdlib.h

C) stdio.h

D) dos.h


14. What is the purpose of fflush() function?

A) flushes all streams and specified streams

B) flushes only specified stream

C) flushes input/output buffer

D) flushes file buffer


15. What does the following declaration mean?int(*ptr)[10].

A) ptr is array of pointers to 10 integers.

B) ptr is a pointer to an array of 10 integers

C) ptr is an array of 10 integers

D) ptr is an pointer to array





Answers:



1. 'C' is often called a ....

B) High level language

2. Each C preprocessor directive begins with ....

A) #

3. C allows arrays of greater than two dimensions, who will determine this?

B) compiler

4. The << operator is used for

B) Left shifting

5. Set of values of the same type, which have a single name followed by an index is called

C) array

6. Which of the following header file is required for strcpy() function?

A) String.h

7. scanf() can be used for reading ...

C) multiple characters

8. A variable which is visible only in the function in which it is defined is called

D) local variable

9. In the loop structure logical expression is checked at the ....................of the loop.

A) first

10. If an array is used as function argument, the array is passed

B) by reference

11. If is necessary to declare the type of function in the calling program if

B) Function returns a non-integer value

12. Which escape character can be used to begin a new line in C ........

D) \n

13. Input/output function prototypes and macros are defined in which header file?

C) stdio.h

14. What is the purpose of fflush() function?

A) flushes all streams and specified streams

15. What does the following declaration mean?int(*ptr)[10].

B) ptr is a pointer to an array of 10 integers




Related Posts

 


Write a Program in C to Find if a Number is Present in a List or not

0

C Program to Find if a Number is Present in a List
Here is a C program to find if a number is present in a list of N numbers or not.


In this program for loop is used to search a number from the list of numbers and array of numbers is used to insert numbers in a list.


If the searched number is matched with any number in the list it throws to print it is presented in the list and if the searched number is not matched with any number in the list it throws to print it is not presented in the list.







 A C Program to Find if a Number is Present in a List of N numbers or not





Steps:
  1.  At first declare integers i, n, m, and array of integers a[10].
  2. Print the message to enter how many elements want to insert and allow to insert.
  3. Print the message to enter the elements in the array.
  4. Use for loop to find out whether the given number is present in the list or not.
  5. Print the message on the screen whether the given number is present in the list or not.




Code:



#include<stdio.h>
#include<conio.h>

void main()
{
int i,n,m,flag=0; int a[10];
clrscr();

printf("How many elements you want to enter \n");
scanf("%d",&n);

printf("Enter element in the array \n");
for (i=0; i<n; i++)
scanf("%d", &a[i]);

printf("Enter the element you want to search \n");
scanf("%d", &m);

for (i=0; i<n; i++)
{
if(a[i]==m)
{
flag=1;
break;
}
}
if(flag==0)
printf("Not present");
else
printf("Present");
getch();
}




Related Posts:



C Program to Find the Sum and Average of Numbers Using Do-While Loop

0

C Program to Find the Sum and Average of Numbers Using Do-While Loop
In this program sum and average of of the given numbers are calculated using do-while loop.

Do-while loop is a looping condition where statements are executed continuously until the condition validates and test the condition after having executed the statements within the loop.

This means that do-while would execute its statements at least once, even if the condition fails for the first time.
 
Scanf() command is used here to allow enter the numbers and sum=sum+num; to sum the numbers within do-while loop.



C Program to Find the Sum and Average of Numbers Using Do-While Loop



Steps: 
  1.  Declare two integers i and n and also initialize i with 0.
  2. Declare three floats sum, avg and num and initialize sum with 0.
  3. Print the message on the screen to enter how many numbers want to find sum.
  4. Use do-while loop to insert the numbers calculate the sum and average.




Code:




#include<stdio.h>
#include<conio.h>



void main()
{

int i=0,n;
float sum, avg, num;

clrscr();

sum=0;

printf("How many numbers you want to find sum and average\n");
scanf("%d",&n);

printf("Enter the numbers\n");

do{
scanf("%f", &num);
sum=sum+num;
i++;
}

while (i<n);

avg=sum/n;

printf("Sum=%f\n", sum);
printf("Average=%f\n", avg);
getch();
}




Related Posts:


Write a Program in C to Sort a List of Numbers in Ascending Order

0

Program in C to Sort a List of Numbers in Ascending Order
In the program below nested  for loop is used to sort a list of  real numbers in ascending order. This program below asks to enter how many numbers want to sort and allow to enter the numbers to sort them in ascending order.
The nested for loop in the program swaps the numbers if first number is greater than the next number. i.e. using (a[j]>a[j+1]) and
       c=a[j];
       a[j]=a[j+1];
       a[j+1]=c;
Here the value of a[j] copied to c and value of a[j+1] copied to a[j] and then value of c is copied to a[j+1].



 Program in C to Sort a List of Numbers in Ascending Order



Steps:
  1. Declare an array with float to insert real numbers.
  2. Declare integers i, j, n, c and flag.
  3. Print the message to enter how many numbers want to insert and allow to enter the number.
  4.  Use for() loop to allow to enter the numbers to sort in ascending order.
  5. Use nested for() loop to to sort the list.
  6. Again use for() loop with printf() command to display the numbers on screen.



Code:



#include <stdio.h>
#include <conio.h>

void main()
{
float a[20];
int i,j,n,c,flag;

clrscr();

printf("how many numbers you want to enter:\n");
scanf("%d", &n);

printf("\Enter the numbers :\n");
for(i=0; i<n; i++)
scanf("%f", &a[i]);


for (i=0; i<n-1; i++)
{
for(j=0; j<n-1-i; j++)
{
if(a[j]>a[j+1])
{
c=a[j];
a[j]=a[j+1];
a[j+1]=c;
flag=0;
}
}
if(flag)
break;
else
flag=1;
}

printf("Stored elements:\n");
for(i=0; i<n; i++)
printf("%f\n", a[i]);
printf("\n");
getch();

}

 



Related Posts:


Write a Program in C to Calculate the Factorial Value of an Integer.

0

Program in C to Calculate the Factorial Value of an Integer
Here is a program in C to calculate the factorial value of an integer.

The factorial of a number is the product of all the integers between 1 and that number.  For example factorial of 5 is 5*4*3*2*1. This can also be expressed as 5!=5*4!, where '!' stands for factorial.

Hence factorial of a number can also be programmed using recursion. Here I have given two methods for calculating factorial of a number, using non-recursive function and using recursive function.




Non-recursive function for calculating the factorial value of an integer

 

Steps:

  1. Declare prototype for the function named factorial() used to calculate factorial value.
  2. Declare two integers a and fact.
  3. Prompt the message to enter any number to calculate the factorial.
  4. Allow the user to enter number using scanf().
  5. Use function factorial() to calculate the factorial value and return that.
  6. Print the returned value to the screen using printf() command. 

 

code:


#include <stdio.h>


int factorial(int);


int main()
{
int a, fact;

printf("Enter any number");
scanf("%d",&a);

fact=factorial(a);
printf("Factorial value-%d\n", fact);
return 0;
}

int factorial(int x)
{
int f=1,i;

for(i=x;i>=1; i--)
f=f*i;

return(f);

}



Recursive function for calculating the factorial value of an integer


Steps:

 

  1. Declare prototype for the function named rec() used to calculate factorial value.
  2. Declare two integers a and fact.
  3. Prompt the message to enter any number to calculate the factorial.
  4. Allow the user to enter number using scanf().
  5. Use function rec() to calculate the factorial value using recursive method and return that.
  6. Print the returned value to the screen using printf() command. 

 


code:


#include <stdio.h>

int rec(int);
int main()
{
int a, fact;

printf("Enter any number");
scanf("%d",&a);

fact=rec(a);
printf("Factorial value-%d\n", fact);
return 0;
}

int rec(int x)
{
int f;

if(x==1)
return(1);
else
f=x*rec(x-1);
return(f);

}






Related Posts:


Write a Program in C to Copy a String to Another.

0

Here is a program in C to copy one string to another string using user defined function. Here two character arrays are defined then prompted to enter the strings and copied to the first string using while() function.

Program in C to Copy a String to Another



Program in C to Copy a String to Another



Steps:
  1. At first  declare two strings str1 and str2 and integers m, i, flag and j under main function.
  2. Prompt message to enter the strings and allow to enter strings using gets() function.
  3. Prompt the message and allow to enter the index where you want to insert in the first string.
  4. Copy second string to the first string using while() function.
  5. Print the first string to the screen.



Code:

#include <stdio.h>
#include <conio.h>

void main()
{
char str1[20], str2[20];
int m,i,flag=0,j;

clrscr();

printf("Enter the 1st String");
gets(str1);
printf("Enter the 2nd String");
gets(str2);

printf("Enter the index after which you want to insert 2nd string in 1st :");
scanf("%d", &m);
i=0;

while (i<=m)
{
i++;
}
j=0;

while (str2[j]!='\0')
{
str1[i]=str2[j];
i++;
j++;
if (str1[i]=='\0')
flag=1;
}

if (flag==1)
str1[i]='\0';
printf("%s", str1); 
getch();




Related Posts:


C Program to Read Set of Real Numbers from Keyboard & Find the Maximum

0

C Program to Read Set of Real Numbers and Find the Maximum
To write a C program to read set of real numbers from keyboard and find the maximum among them, you can use a function which takes an array of real numbers and its size as arguments and return the maximum.


Using this function you can write a program to read a set of real numbers from the keyboard and find the maximum number in the array.






C Program to Read Set of Real Numbers and Find the Maximum



Steps: 
  1. Define a function max() 
  2. Under main() function, declare two integers i and n.
  3. Declare an array a.
  4. Prompt the message to the user to insert how many elements they want to enter using printf() and allow to enter using scanf().
  5. Prompt the message and allow to enter the elements.
  6. Find out the maximum number among them using max() function.
  7. Print the maximum number along with message.

Code:


#include<stdio.h>
#include<conio.h>

max(float a[], int n);

void main()
{

int i,n;
float a[100];


printf("\n How many elements you want to enter:\n");
scanf("%d",&n);

printf("\n Enter the elements:");
for(i=0;i<n;i++)
scanf("%f",&a[i]);
max(a,n);
getch();
}

max(float a[], int n)

{
int i;
float k, large;
large=a[0];
for (i=1;i<n;i++)
{
if (a[i]>large)
{
k=a[i];
a[i]=large;
large=k;
}
}

printf("Largests element is : %f", large);

return 0;

}


 

Related Posts: 


Write a Program in C to Determine Whether a Number is Prime or Not.

0

Program in C to Determine Whether a Number is Prime or Not.
"A prime number is one, which is divisible only by 1 or itself."

To determine whether a number is prime or not, we have to divide the number successively by all numbers from 2 to one less than itself.

If remainder of any of these divisions is zero, the number is not a prime.

If no division yields a zero then the number is a prime number.



Program in C to Determine Whether a Number is Prime or Not


Steps:

  1. Declare integers num and i inside main()
  2. Prompt the message allow the input using printf() and scanf()
  3. Test whether a Number is prime or not using while() function.

Code:

#include <stdio.h>

int main()
{

int num, i;


printf("Enter a number");
scanf ("%d",&num);

i=2;

while (i<=num-1)
{

if (num%i==0)
{
printf("Not a prime number\n");
break;
}

i++;
}

if (i==num)

printf("Prime number\n");

return 0;
}



Related Posts: 



Solved MCQ of Programming in C set-3

0

Solved MCQ of Programming in C
Dependency graph for tgmath.h header file in C Programming Language (Photo credit: Wikipedia)
1. C language is available for which of the following operating systems?

A) DOS

B) Windows

C) Unix

D) All of the above


2. Which of the following are tokens in C?

A) Keywords

B) Variables

C) Constraints

D) All of the above


3. C was developed in the year .....................

A) 1970

B) 1972

C) 1976

D) 1980


4. Which escape character can be used to beep from speaker in C?

A) \a

B) \b

C) \m

D) \n


5. Which of the following is a keyword is used for storage class?

A) printf

B) external

C) auto

D) scanf


6. Continue statement is used .............

A) to go to the next iteration in a loop

B) come out of a loop

C) exit and return to the main function

D) restarts iteration from beginning of loop


7. File manipulation functions in C are available in which header file?

A) streams.h

B) stdio.h

C) stdlib.h

D) files.h


8. A compiler ................

A) is a computer program

B) translates a high level language into machine language

C) is a part of software

D) editor


9. Explicit type conversion is known as ....................

A) casting

B) conversion

C) disjunction

D) separation


10. A function popularly used C input function

A) scanf

B) printf

C) getch

D) Char



Answers:



1. C language is available for which of the following operating systems?

D) All of the above

2. Which of the following are tokens in C?

D) All of the above

3. C was developed in the year .....................

A) 1970

4. Which escape character can be used to beep from speaker in C?

B) \b

5. Which of the following is a keyword is used for storage class?

C) auto

6. Continue statement is used .............

A) to go to the next iteration in a loop

7. File manipulation functions in C are available in which header file?

B) stdio.h

8. A compiler ................

B) translates a high level language into machine language

9. Explicit type conversion is known as ....................

A) casting

10. A function popularly used C input function

A) scanf


Related Posts


Objective Questions of C with answer set-2

0
1. Hierarchy decides which operator
A) is most important
B) is used first
C) is fastest
D) Operates on largest numbers

2. A pointer can hold
A) Single address at a time
B) Two addresses at a time
C) Number of addresses at a time
D) No address
3. An integer constant in C must have
A) At least one digit
B) At least one decimal point
C) A comma along with digits
D) Digits separated by commas

4. main() {
                Int a=3, b=2, c*d*e;
                d=&a; e=&b;
                c=*d+*e;
                }
                Which one of the given answers is correct?
A) a=4, c-6
B) a=3, c=5
C) a=3, c=6
D) a=3, c=8

5. In C a variable cannot contain
A) Blank Spaces
B) Decimal Point
C) Hyphen
D) All of the above

6. Assume that variable x resides at memory location 1234, y at 1111 and p at 2222.
                Int x=1, y=2, *p;
                p=&x;
                y=*p;
What will be the value of y after execution of above code?
A) 2
B) 1
C) 1234
D) 1111

7. Which of the following is FALSE in C?
A) Keywords can be used as variable names
B) Variable names can contain a digit
C) Variable names do not contain a blank space
D) Capital letters can be used in variables

8. If an integer occupies 4 bytes and a character occupies 1 byte of memory, each element of the following structure would occupy how many bytes ?
                struct name {
                int age;
                char name[30];
                };
A) 30
B) 32
C) 34
D) 36

9. The expression x=4+2 % -8 evaluates to
A) -6
B) 6
C) 4
D) None of the above

10. A structure brings together a group of
A) items of the same data type
B) related data items and variables
C) integers with user defined names
D) floating points with user defined names

Answers:
1. B) is used first
2. A) Single address at a time
3. A) At least one digit
4. B) a=3, c=5
5. A) Blank Spaces
6. B) 1
7. A) Keywords …… variable names
8. C) 34
9. B) 6
10. B) related data items and variables

You Might also view the following Related Posts

Solved MCQ of C set-1

0

1. C language has been developed by
A) Martin Richards
B) Bijarne Stroustrup
C) Dennis Ritche
D) Ken Thompson

2. int[ ] ={5,6,7,8,9} What is the value of a[3]?
A) 9
B) 8
C) 7
D) 6


3. C can be used on
A) Only MS-Dos operating System
B) Only Linux operating system
C) Only Windows operating system
D) All of the above


4. Float a[15], what is the size of array?
A) 17
B) 14
C) 15
D) 16

5. C programs are converted into machine language with the help of
A) An Editor
B) A complier
C) An operating system
D) None of the above

6. Array is
A) Primary data type
B) Pointer data type
C) Heterogeneous data type
D) Homogenous data type

7. Which of the following is allowed in a C Arithmetic Instruction?
A) [ ]
B) { }
C) ( )
D) None of the above

8. To accept 100 different values into the array we require
A) Loop
B) If condition
C) Function
D) Structure

9. If a is an integer variable, a=7/3; will return a value
A) 2.5
B) 3
C) 0
D) 2

10. Pointer holds
A) Value of variable
B) Address of variable
C) Value and address of variable
D) Always null

Answers:
1. C) Dennis Ritche
2. B) 8
3. D) All of the above
4. C) 15
5. B) A complier
6. D) Homogenous data type
7. C) ( )
8. A) Loop
9. D) 2
10. B) Address of variable

You Might also view the following Related Posts

يتم التشغيل بواسطة Blogger.