Thursday 31 August 2017

Preprocessor Directive

A pre-processor directory is a set of text which is start with # symbol. When C source code compile then process of compilation get start from pre-processor directory. It means all pre-processor directories compile before actual compilation.

Preprocessor Directive C Language

Example
  • Header fil

Computer Fundamental MCQ CCC

CCC Fundamental MCQ/True-False Question with Answer

Multiple Choice

1. How many types of memory used in computer?
A) 1
B)  2
C) 3
D) 4

2.  Which Type of memory got outdated?
A) PROM
B)EEPROM
C)CD

Wednesday 23 August 2017

Command Line Argument

C language is known as a language of building block of function. It means all the things achieved by the language using function.

A function is a set of some valid statements of language. Which achieved some specific task? You need to know some information about function before using it.
  • Function name
  • Return type

Tuesday 22 August 2017

Print Some Character from a File

Q : Write a ‘C’ program to print only first 12 characters including blank space from file test.txt.
Solution :

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

void main()
{
     FILE *pt;
     int i;
     char ch;
     pt=fopen("test.txt","r");
     if(pt==NULL)

Structure size without sizeof operator

Q : Write a ‘C’ program to find size of structure without using sizeof operator.

Solution :


#include<stdio.h>
typedef struct stu
{
     int roll;
     char name[20];

Monday 21 August 2017

Write A Line to File

Q: Write a ‘C’ program to write a line of string at a text file.

Solution : 


#include<stdio.h>
void main()
{
     FILE *pt;
     char ar[100];
     int i;
     printf("Enter the Text>> ");
     gets(ar);
     pt=fopen("test.txt","w");
     if(pt==NULL)
          puts("Unable to open file");
     else
     {
          for(i=0;ar[i]!='\0';i++)
               putc(ar[i],pt);
     }
     printf("\nData created successfully");
     fclose(pt);
    
}

Saturday 19 August 2017

Sorting C Language Keyword Program

Q : Write a ‘C’ program to list of keywords which must be sorted in increasing order in the table.

Solution : 


#include<stdio.h>
int power(int,int);
void main()
{

     char keyword[][15]={"char","do","extern","if","return","static","union","while","case","default","enum","goto","register","

Friday 18 August 2017

Disable Enable Datagrid column Editing

You can  disable to edit some column and make other read only from DataGridview in Windows Programming, For some special circumstances like on a shop sales bill editing . A user need to change product, quantity and rate but not Total . Total will be calculated by product of rate and quantity. If Total pr

CCC Syllabus



COURSE ON COMPUTER CONCEPTS (CCC)


OBJECTIVE:


The course is designed to equip a person to use computers for professional as well as day to day use. It provides theoretical background as well as in depth knowledge of Software/ packages. After completing the course the incumbent will be digitally literate and will be able to:

Thursday 17 August 2017

Power of number using function

Q: Write a ‘C’ program to find the power of number using function.?

Solution :


#include<stdio.h>
int power(int,int);
void main()
{
     int n,p;
     printf("Enter number>> ");
     scanf("%d",&n);

Wednesday 16 August 2017

Word Count

Q : Write a ‘C’ program to count number of words in a string.

Solution :



#include<stdio.h>
void main()
{
      char str[50];

Sunday 13 August 2017

Jquery HTML Tag Select


Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero.

Jquery Name Selector


You can select html control by its name. Selecting a single control or group of controls is become important in some special web operation requirement. I am going to demonstrate you to select more than one checkbox for payment which may be useful to design some payment related website.


Roll Name Subject
101 Sona Hindi
102 Mona Art
103 Sita Maths
104 Anita English
105 Babita Hindi


Code : 



<html>
<head>

Saturday 12 August 2017

C Language O Level January-2014 Solved Paper


1. Multiple Choice


1.1 : D
Explanation :  
Integer and float both are in arithmetic statement So integer will be promoted as float . final result will be consider as float that is why sizeof operator print 4 instead of 2.

Variable is not initialized after decoration So variable will have garbage data which most of time be a negative number. So   6-1=5

Friday 11 August 2017

Array of structure

Q: Define a structure of student with the following fields: rollNo, name and marks. Write a program to read and store the data of at most 30 students in an array. Also display the average marks of
the students.

Solution : 


#include<stdio.h>
#define MAX 3
typedef struct Stu
{
     int roll;
     char name[20];
     int mark;
}student;

IDENT_CURRENT SQL Server

IDENT_CURRENT returns newly inserted record‘s auto increment value. So you can use this data while inserting a record it can be useful in many times. For example you want to return newly inserted record is for other task etc.


 USE [girfa]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:        Raj Kumar
-- Create date: 08-Aug-2017
-- Description:   Girfa Student Help
-- =============================================
alter PROCEDURE [dbo].[adddata]

Vowel Count Switch statement

Q : using a switch statement, write a function to count the number of vowels and number of blanks
in a character array passed to it as an argument.

Solution 



#include<stdio.h>
#define MAX 20
void count(char*);

Prime number in given range

Q : Write a program to display all the prime numbers between two positive integers m and n. The values of m and n are to be taken from the user.

Solution : 


#include<stdio.h>
void main()
{
     int n,m,p;
     printf("Enter range starting number>> ");
     scanf("%d",&m);

Thursday 10 August 2017

Jquery ID Selector

Enter Comment:



<html>
<head>
<title>Jquery Selector Girfa Student Help</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
   $(document).ready(function(){
    $("button").click(function(){
        $("#container").text($("#data").val());
    });
});
</script>
</head>
<body>
Enter Comment:  <br /><textarea id="data" rows="7" cols="50"></textarea><br /><br /> <button>Add</button>
<p id="container">

</p>
</body>

Wednesday 9 August 2017

Jquery class selector

You can select a HTML tag with its class name which is used by tag. When you know class name then you can add custom HTML from a function of java script using jquery class selector.

<html>
<head>
    <title>Girfa Student Help</title>
    <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
    <style>
        .para
        {
            text-align:center;

Tuesday 8 August 2017

2d Array Compare

Q : Write a function that returns 1 if the two matrices passed to it as argument are equal and 0
otherwise.

Solution : 


#include<stdio.h>
#include<conio.h>
#define ROW 2
#define COL 2
int compare(int a1[ROW][COL],int a2[ROW][COL]);
void main()
{
     int ar1[ROW][COL],ar2[ROW][COL],r,c;
     clrscr();

Jquery Page Scroller



Jquery Page Scroller


Page scroller make your web page design more attractive and formal because when a user want see other part of your page, then  he/she need to scroll page up or down using scroll bar or mouse wheel which was accepted before of jquery. Now if we have jquery then why we used traditional page design.So scroller you page using jquery.

Page scroller also helps to design single page website.

Scroll to Top of window

$('html, body').animate({ scrollTop: 0 }, 0);
$('html, body').animate({ scrollTop: 0 }, 'slow');


Scroll to selected area of web page

function Trans(id)
        {
            $('html, body').animate({

Monday 7 August 2017

Average Age Calculation with dynamic structure array

Q : Write a program which asks the user to enter the name and age of persons in his group. The numbers of persons is not known to the user in the beginning of the program. The user keeps on entering the data till the user enters the age as zero. The program finally prints the average
age.

Solution :

#include<stdio.h>
#include<conio.h>
typedef struct stu
{
      char name[20];
      int age;
      struct stu * next;

Friday 4 August 2017

* Operator Pointer

Pointer is a special type of variable which hold address of a location in memory. * symbol is use to make pointer. You can manipulate any variable data though pointer from other function. Change will be permanent when it been done with pointer because pointer has actual physical location of a variable.

You can manipulate a variable data using pointer. By
  • First make a pointer variable
  • Assign address of variable to pointer
  • Access variable data though * operator

Sum of series

#include<stdio.h>
void main()
{
     int i,j,k=0;
     char sym='+';
     printf("Enter n>> ");
     scanf("%d",&i);

Thursday 3 August 2017

Multiplication Table

#include<stdio.h>
void table(int);
void main()
{
     int i;
     printf("Enter number>> ");
     scanf("%d",&i);
     table(i);
    

Flow Chart Factorial Number

SQL Server output parameter


Output Parameter

Store procedure is a set of some sql statement which saved on server. Store procedure takes argument for database operation which is known parameter. There are two type of parameter.

Input parameter

When user provides a value as parameter and passes to store procedure.

Output Parameter

When user hold something returns from store procedure through parameter known as output parameter.

Advantage

  • Decrease complexity because it help you to do more than one task in single procedure
  • when inserting data to a table and you need to get the identity value back
  • when perfoming select statements and you need some extra data,
  • when updating or inserting data and you need some way to know if the operation was successful
  • for most if not all of the reasons you need out or ref parameters in c#




Store Procedure

USE [Girfa]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[pcheck]
(
@id bigint,
@phone varchar(15) output
)

as
as


select @phone= MobileNo from dbo.UserMaster where UserId=@id

C# Code

UserModel ob = new UserModel();

try

 {

    using (SqlConnection dbCon = new  SqlConnection(ConfigurationManager.ConnectionStrings["dbConnection"].ToString()))

    {

 

        using (SqlCommand cmd = new SqlCommand("[dbo].[pcheck]", dbCon))

        {

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@id", Convert.ToInt32(id));

            cmd.Parameters.Add("@phone", SqlDbType.VarChar, 30);

            cmd.Parameters["@phone"].Direction = ParameterDirection.Output;

            if (dbCon.State == ConnectionState.Closed)

                    dbCon.Open();

            cmd.ExecuteNonQuery();

            b.MobileNo = Convert.ToString(cmd.Parameters["@phone"].Value);

        }

 

     }

}

catch (Exception ex)

{

              

}

 

return ob;




Wednesday 2 August 2017

Passing Array to function


Q : Write a function which accepts an array of size n containing integer values and returns average of all values. Call the function from main program.

Solution :


#include<stdio.h>
#include<conio.h>
int avg(int[],int);
void main()
{
     int ar[5],i;
     clrscr();
     for(i=0;i<5;i++)
     {
          printf("Enter %d number

Write a program to bonus calculation using structure

Q : Write a C program to store the employee details with the following attribute?



Sr No.
Basic Salary
Sales Percentage
Bonus Amount
1
<=7000
<=10
1500
2
<=7000
>=10
3000
3
>7000 and <=15000
<=10
2000
4
>7000 and <=15000
>=10
4000
5
>15000
<=10
2500
6
>15000
>=10
4500

Solution : 


/* ============================================
          Girfa Student Help
          Program : Salary Calculation
          For more program visit :http://girfahelp.blogspot.in/p/c-language-structure-programming.html
================================================*/
#include<stdio.h>
#include<conio.h>
typedef struct stu
{
     int empid;
     int pf;
     int mediclaim;
     int basicsal;
     int sp;