C& CPP Tutorials
About C
Program Structure
Running C Program
Variables, constants
Operators
Control Structure
Array
Function
Pointers
Preprocessor
Structure
File
Bitwise Operators
Recursion
 Data Structures
Introduction
Stacks
Queues
Linked List
Sorting 
Searching
 Test Your Skill
Fundamentals
Input and Output
Branching and Looping
Function
Pointers I
Pointers II
Structure and Union
Sample Problems I
Sample Problems II
 Help and Support
C Forum
Source code
C  Yahoo Group
C Compilers
 


Challenging Programming Problems -Part II

 [Q001] Write a program (W.A.P.) in C to clear the screen and print "Freshersworld" on each line, forming a diagonal pattern running from upper-left to lower right.[Use suitable delay]

 
[Q002] W.A.P. in C to SORT the array of strings based on first 3-LETTERS ONLY.

 
[Q003] Some C Functions take variable argument list in addition to taking a number of fixed (known) parameters. Implement using USER-DEFINED C FUNCTION that take VARIABLE ARGUMENT LIST and COMPUTE THE SUM OF VALUES specified in the list.
 Ex: int Sum(int a,...) // Here ... means VARIABLE ARGUMENT LIST
       {
            // Your Code Goes Here to access the values in the variable argument list
       }
       void main(void)
       {
            printf("%d",Sum(5,6,7,8,9,10)); // Prints the RESULT (Sum of these values=45)
       }

   
[Q004] W.A.P. in C to compute the sum of two values using function that takes two arguments (INTEGERS) and IT SHOULD RETURN the sum WITHOUT USING the RETURN statement but the return type of function is INTEGER ('int' data type). [NOTE : DO NOT MAKE USE OF ANY GLOBAL VARIABLES OR POINTER CONCEPT]

 
[Q005] W.A.P. in C to SWAP the contents of TWO VARIABLES WITHOUT using ASSIGNMENT OPERATOR.
[HINT : USE 'asm' statement]


 [Q006]
W.A.P. in C to FIND THE LARGEST of two numbers (integer) WITHOUT using ?:  operator, if, if...else and switch statements. [HINT : USE 'asm' statement]
 

 
 [Q007] W.A.P. in C to print the following output WITHOUT USING GOTO STATEMENT, CONDITIONAL STATEMENTS (if, if...else & switch statements) and ANY LOOP STATEMENTS (for, while & do..while) :
 (a)
     *****
     ****
     ***
     **
     *


 
(b)
     *
     **
     ***
     ****
     *****

 
[
Q008]
W.A.P. in C to REVERSE THE WORDS IN A GIVEN LINE OF TEXT. [HINT : USE Built-in function 'strtok' in 'string.h' header file]

  
[Q009] W.A.P. in C to CONVERT THE TEXT within /* ... */ to UPPER-CASE (all occurrences) from the SPECIFIED C Source Code File and save the file without altering the remaining text.


[Q010]
W.A.P. in C to READ a line of text and WRITE it out BACKWARDS using RECURSIVE Function.

Solutions for the above queries.

Back   Next
 

Google