Pages

Sunday, November 27, 2016

Questions based on Algorithm

Define: Algorithm.

Write a short note on properties related to any algorithm.

State the difference between Algorithm and Flowchart.

Write various steps (algorithm) to multiply given two numbers.

Giving suitable example, explain how given pseudo-code can be converted into algorithm.

The ________ is a procedure or step by step process for solving a problem.

More question will be added soon.....

* * * * *




Saturday, November 26, 2016

Short questions (MCQs) based on Array

MCQs based on Array Set-1

To store 1 subject marks of 10 students in C program; _____________ type of array is useful.
A. 1-D
B. 2-D
C. multi-dimensional
D. none of these

To store 5 subjects’ marks of 50 students, _____________ type of array is useful.
A. 1-D
B. 2-D
C. multi-dimensional
D. none of these

Identify the suitable variable declaration for storing name of 10 students in C program.
A.  int name[10];
B.  char name[10][30];
C.  char name;
D. none of these

How many array elements will be declared in following statement?
int marks[10];
A. 10
B. 9
C. 11
D. none of these

What is the first index number in the 1-D array of C language?
A. 0
B. 1
C. none of these

For the following C program variable declaration:
     int age[]={6,4,3,5,0};
what is the output of statement: printf(“%d”, age[1]);
A. 6
B. 4
C. 3
D. 0

Predict the output of following code:
int main() {
                int answer, num[5]={1,2,3,4,5};
                printf("%d\n", num[4]);
                return 0;
}
A. 1
B. 4
C. 5
D. none of these





More questions and answers will be added soon....

* * * * *


Answer of MCQs based on Array

To store 1 subject marks of 10 students in C program; _____________ type of array is useful.
A. 1-D
B. 2-D
C. multi-dimensional
D. none of these
ANSWER: A

To store 5 subjects’ marks of 50 students, _____________ type of array is useful.
A. 1-D
B. 2-D
C. multi-dimensional
D. none of these
ANSWER: B

Identify the suitable variable declaration for storing name of 10 students in C program.
A.  int name[10];
B.  char name[10][30];
C.  char name;
D. none of these
ANSWER: B

How many array elements will be declared in following statement?
int marks[10];
A. 10
B. 9
C. 11
D. none of these
ANSWER: A

What is the first index number in the 1-D array of C language?
A. 0
B. 1
C. none of these
ANSWER: A

For the following C program variable declaration:
    int age[]={6,4,3,5,0};
what is the output of statement: printf(“%d”, age[1]);
A. 6
B. 4
C. 3
D. 0
ANSWER: B

Predict the output of following code:
int main() {
                int answer, num[5]={1,2,3,4,5};
                printf("%d\n", num[4]);
                return 0;
}
A. 1
B. 4
C. 5
D. none of these

ANSWER: 5

* * * * *

Friday, November 25, 2016

Answer of MCQs based on String

The ______ character is used to indicate end of string in C programming.
A.  ‘\0’
B.  \\
C.  “
D.  none of these
ANSWER: A

The char data type in C program occupies ______ byte of space in memory.
A. 1
B. 2
C. 4
D. none of these
ANSWER: A

The string processing related functions are stored in ____________ header file.
A. <stdio.h>
B. <conio.h>
C. <string.h>
D. none of these
ANSWER: C

The ______ in-built function can be used to find length of given string in C program.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these
ANSWER: A

The ______ in-built function can be used to concatenate given two string in C program.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these
ANSWER: B

______ C string function can be used to search string into given string.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these
ANSWER: C

_________ function can be used to read two words at a time.
A. scanf( )
B. gets( )
C. getch( )
D. none of these
ANSWER: B

Predict the output:
  #include<string.h>
  void main()
  {
    char str1[10]="abyz";
    int i;         
        for(i=0; i<4; i++)
        {
             printf("%c",str1[i] - 32);
        }         
  } 
A. AB
B. zyba
C. abyz
D. ABYZ
ANSWER: D

Predict the output:
  #include<string.h>
  int main()
  {
            char str1[50]="abc", str2[50];
            strcpy(str2, strrev(str1));
            printf("Reverse string is : %s",str2);
            return 0;
  } 
A. abc
B. cba
C. ABC
D. none of these

ANSWER: B

* * * * *



MCQs based on String

MCQs C String Set-1


The ______ character is used to indicate end of string in C programming.
A.  ‘\0’
B.  \\
C.  “
D.  none of these

The char data type in C program occupies ______ byte of space in memory.
A. 1
B. 2
C. 4
D. none of these

The string processing related functions are stored in ____________ header file.
A. <stdio.h>
B. <conio.h>
C. <string.h>
D. none of these

The ______ in-built function can be used to find length of given string in C program.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these

The ______ in-built function can be used to concatenate given two string in C program.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these

______ C string function can be used to search string into given string.
A. strlen( )
B. strcat( )
C. strstr( )
D. none of these

_________ function can be used to read two words at a time.
A. scanf( )
B. gets( )
C. getch( )
D. none of these

Predict the output:
  #include<string.h>
  void main()
  {
    char str1[10]="abyz";
    int i;
           
            for(i=0; i<4; i++)
            {
                        printf("%c",str1[i] - 32);
            }         
  }
A. AB
B. zyba
C. abyz
D. ABYZ

Predict the output:
   #include<string.h>
   int main()
  {
            char str1[50]="abc", str2[50];

            strcpy(str2, strrev(str1));
           
            printf("Reverse string is : %s",str2);
            return 0;
   }
A. abc
B. cba
C. ABC
D. none of these



Click here to check answer of this MCQs.


More questions and quiz answers will be added soon……

* * * * *


Monday, November 21, 2016

Questions based on String in C programming

  • What do you mean by a string in C program?
  • Give the use of ‘\0’ in a C String program.
  • List in-built string processing functions of C language.
  • State the use of strlen() function in C program.
  • Explain use of strcmp() function with suitable example.
  • Give the difference between strcpy( ) and strcmp( ) function.
  • Which in-built string function can be used for Searching inside a given string?
  • Show use of any three functions to read a character from user.
  • Write logic to find length of given string without using any in-built string function.
  • Can we perform arithmetic processing on a character in C program?
  • Write logic to copy string 1 into string 2 without using any in-built string function.

  • Predict the output of following loop:
     for( i=’A’; i < ‘Z’; i++)
         printf(“%c”, i);

  • Predict the output of following loop:
     for( i='0'; i<='9'; i++)
         printf("%d ", i);


More String related questions will be posted soon……


* * * * *

Questions based on Looping in C language


  • List the looping statements available in C language.
  • Describe syntax of “for” loop with suitable example.
  • What do you mean by entry controlled and exit controlled loop in C language?
  • Giving suitable example, explain use of do….while loop to create menu under C program.
  • Briefly describe the examples of entry controlled loops of C language.
  • State the difference between while and do…while statement of C program.
  • Describe syntax of do…while statement with suitable example.
  • Write a C program to print 1, 2, 3, …..N using for loop (Read N from user).
  • Write a C program to print Z, Y, X, …….A using while loop.
  • Write a C program to print 1, 2, 4, 8, 16, 32, 64 …..N using do….while loop (Read N from user).
  • Justify the statement: “do….while loop in a C programming is one of the entry controlled loop”.
  • What do you mean by infinite loop? Give suitable of any infinite loop in a C program.
  • Predict the output of following loop:
     for( i=0; i<10; i++)
        printf(“%d”, i+2);

  • Predict the output of following loop:
     for( i=65; i < 70; i++)
        printf(“%c”, i);



More questions will be added soon….today…

* * * * *

Sunday, November 20, 2016

MCQs based on Flowchart with Answer

The _______ provides pictorial representation of given problem.
A. Algorithm
B. Flowchart
C. Pseudocode
D. All of these
ANSWER: B

_______ is a procedure or step by step process for solving a problem.
A. Algorithm
B. Flowchart
C. Pseudocode
D. All of these
ANSWER: A

The ______  symbol is used at the beginning of a flow chart.
A. Circle
B. Rectangle
C. Diamond
D. None of these
ANSWER: A

The _______ symbol is used to represent decision in flowchart.
A. Circle
B. Rectangle
C. Diamond
D. None of these
ANSWER: C

The _______ symbol is used to represent process in flowchart.
A. Circle
B. Rectangle
C. Diamond
D. None of these
ANSWER: B

_________ symbol is used to represent input and output operation in flowchart.
A. Circle
B. Rectangle
C. Diamond
D. Parallelogram
ANSWER: D

______ is a symbol used connects two symbols of flowchart.
A. Circle
B. Rectangle
C. Diamond
D. Arrow
ANSWER: D
* * * * *

Top 10 Flowchart Examples

Self Study Tutorials YouTube Channel



< Home Page >

MCQs based on Flowchart

The _______ provides pictorial representation of given problem.
A. Algorithm
B. Flowchart
C. Pseudo-code
D. All of these

_______ is a procedure or step by step process for solving a problem.
A. Algorithm
B. Flowchart
C. Pseudo-code
D. All of these

The ______  symbol is used at the beginning of a flowchart.
A. Circle
B. Rectangle
C. Diamond
D. None of these

The _______ symbol is used to represent decision in flowchart.
A. Circle
B. Rectangle
C. Diamond
D. None of these

The _______ symbol is used to represent process in flowchart.
A. Circle
B. Rectangle
C. Diamond
D. None of these

_________ symbol is used to represent input and output operation in flowchart.
A. Circle
B. Rectangle
C. Diamond
D. Parallelogram

______ is a symbol used connects two symbols of flowchart.
A. Circle
B. Rectangle
C. Diamond
D. Arrow


* * * * *

Saturday, November 12, 2016

C program to print Software Installation Bar.

#include<stdio.h>
#include<Windows.h>

//setxy function sets the cursor coordinate X, Y
COORD c = {0, 0};
void setxy (int x, int y){
 c.X = x; c.Y = y; // Set X and Y coordinates
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}

int main(){
    int i;
    printf("\n Installing Software ....\n");
    for(i=0; i<=100; i++)
    {
        setxy(i,2);
        printf("%c ", 219);
    
        setxy(0,3);
        printf("%d %%", i);
    
        Sleep(100);
    }
    printf("\n\n Software Successfully Installed...");
    getch();
    return 0;
}


Output of the program:

You will see Installation bar progressing from 0 % to 100% as shown below:




Friday, November 11, 2016

C program to Blink a Text on screen.


#include<stdio.h>
#include<Windows.h>

int main(){
    int i;
    for(i=0; i<10; i++)
    {
      printf(".....WEL COME.....");
      Sleep(500);
      system("cls");
      Sleep(500);
    }
    getch();
    return 0;
}


Following Text will Blink on output screen:

..... WEL COME .....




Wednesday, November 9, 2016

Use of Time function in C program.

Program will demonstrate use of sleep function in C.

#include<stdio.h>
#include<Windows.h>
int main()
{
   int i;
   printf("Use of time function...\n");       
   printf("\nPress any key to install your software...");
   getch();
    
   for(i=0; i<=100; i++)
   {
      system("cls");
      printf("Installing Software ....%d %%", i);
      Sleep(50);
   }
   Sleep(3000);
   printf("\n\nSoftware Successfully Installed...");
   return 0;
}



Output of the program:


Use of time function...

Press any key to install your software...


When you press any key you will get following output on your screen:

Installing Software ....100 %

Software Successfully Installed...





You may also like to learn following programs:

Sunday, November 6, 2016

Advantages and Disadvantages of C Language

C Language Advantages

  • C is compiler based language; hence programmers can compile their program to check for any errors.
  • C programming is easy to learn for the beginners.
  • C language provides lot of in-built library functions.
  • C is portable language. C executable program can be executed on other similar systems.
  • C supports many arithmetic, logical, relational and bitwise operators.
  • C provides good functionalities for System level programming. Many operating systems are developed using C language. UNIX was developed using C language.
  • Low-level access to computer memory is possible using C language.
  • C supports user defined function development.
  • C provides good Graphics support.
C Language Disadvantages

  • C is not an object oriented language; hence C does not support any Object Oriented Programming (OOP) concepts like Inheritance, Encapsulation and Polymorphism.
  • C language does not support any exception handling.
  • C does not support any runtime error checking mechanism.
  • C does not provide support for namespace like C++.


* * * * *

Friday, November 4, 2016

Answer of MCQs based on C programming Expression evaluation

C programming Expression evaluation - Answers

Associativity of ++, -- and ! Operators in expressions evaluation are from ________.
A. left to right
B. right to left
C. none of these
ANSWER: B

An arithmetic expression without parenthesis will be evaluated from left to right using rules of precedence of operators.
A. True
B. False
C. None of these
ANSWER: A

In C programming, the statement a=a+1 and a+=1 will produce same result.
A. True
B. False
C. None of these
ANSWER: A

All the variables in expressions must be assigned values before evaluation is attempted.
A. True
B. False
C. None of these
ANSWER: A

Associativity of + and - Operators in expressions are from ________.
A. left to right
B. right to left
C. none of these
ANSWER: A

In C programming, the statement a=a*(n+1) and a=*n+1 will produce same result.
A. True
B. False
ANSWER: B

In a pretest loop if the body is executed n times the test expression is executed n+1 times.
A. True
B. False
C. None of these
ANSWER: A

Within an expression, __________ precedence operators will be evaluated first.
A. higher
B. lower
C. none of these
ANSWER: A

The __________ represents which operator should be evaluated first if an expression is containing more than one operator with same priority.
A. Priority
B. Associativity
C. none of these

ANSWER: B


MCQs based on C programming Expression evaluation


Associativity of ++, -- and ! Operators in expressions evaluation are from ________.
A. left to right
B. right to left
C. none of these

An arithmetic expression without parenthesis will be evaluated from left to right using rules of precedence of operators.
A. True
B. False
C. None of these

In C programming, the statement a=a+1 and a+=1 will produce same result.
A. True
B. False
C. None of these

All the variables in expressions must be assigned values before evaluation is attempted.
A. True
B. False
C. None of these

Associativity of + and - Operators in expressions are from ________.
A. left to right
B. right to left
C. none of these

In C programming, the statement a=a*(n+1) and a=*n+1 will produce same result.
A. True
B. False

In a pretest loop if the body is executed n times the test expression is executed n+1 times.
A. True
B. False
C. None of these

Within an expression, __________ precedence operators will be evaluated first.
A. higher
B. lower
C. none of these

The __________ represents which operator should be evaluated first if an expression is containing more than one operator with same priority.
A. Priority
B. Associativity
C. none of these


* * * * *