.
  Vyom World.com . Let's Touch the Sky Together!  
.

Home
VyomWorld.com Home
Interview Questions
VyomLinks.com Home
JobsAssist.com Home
Vyom Network
Contact Us
Jobs & Careers
Resume Submitter
Placement Papers
IT Companies Directory
Computer Jobs
Interview Questions
Online Exams
Vyom Career eMag.
Fun
Send FREE SMS!
SMS Jokes
Source Codes Library
Source Codes Home
ASP Source Codes
C Source Codes
C++ Source Codes
COBOL Source Codes
Java Source Codes
Pascal Source Codes
Submit Source Codes
GATE
GATE an Overview
GATE Preparation
Study Materal
GRE
GRE an Overview
GRE Questions
GRE Preparation
GRE Universities
TOEFL Preparation
TOEFL Resources
GMAT Preparation
GMAT Resources
MBA Preparation
MBA Resources
Networking Concepts
Networking Concepts
Testing Preparation
Testing Resources
Webmasters
Free Traffic Builder
Webmaster Articles
Web Hosting
Tutorials
Hardware Tutorial
1500 Free eBooks New!


Home » Placement Papers » IBM Placement Papers » IBM Previous Year Placement Paper

 

IBM Placement Paper - Programming Question And Answers


Advertisements
Advertisements




IBM Previous Years Solved Sample Placement Papers

1. Find HCF of Two Numbers Without Using Recursion

#include <iostream>
using namespace std;
int main()
{
    int m, n;
    scanf("%d", &m);
    scanf("%d", &n);
    while (m != n)
    {
        if (m > n)
        {
            m = m - n;
        }
        else
        {
            n = n - m;
        }
    }
    printf("%d", m);
    return 0;
}
            

2. Properly Compress a String

import java.util.*;

public class Main {
    public static String properCompression(String s) {
        StringBuilder compressedStr = new StringBuilder();

        for (int i = 0; i < s.length(); i += 2) {
            char c = s.charAt(i);
            int count = Character.getNumericValue(s.charAt(i + 1));
            while (count > 0) {
                compressedStr.append(c);
                count--;
            }
        }

        return compressedStr.toString();
    }

    public static void main(String[] args) {
        String inputStr = "a3b5c2a2";
        String compressedResult = properCompression(inputStr);
        System.out.println(compressedResult); // Output: "aaabbbbbcc"
    }
}
            

3. Convert Decimal Number to Binary

#include <iostream>
using namespace std;
int main()
{
    int a[10], n, i;
    cout << "Enter the number to convert: ";
    cin >> n;
    for (i = 0; n > 0; i++)
    {
        a[i] = n % 2;
        n = n / 2;
    }
    cout << "Binary of the given number= ";
    for (i = i - 1; i >= 0; i--)
    {
        cout << a[i];
    }
}
            

4. Generate Fibonacci Triangle

#include <iostream>
using namespace std;
int main()
{
    int a = 0, b = 1, i, c, n, j;
    cout << "Enter the limit: ";
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        a = 0;
        b = 1;
        cout << b << "\t";
        for (j = 1; j < i; j++)
        {
            c = a + b;
            cout << c << "\t";
            a = b;
            b = c;
        }
        cout << "\n";
    }
    return 0;
}
            

5. Output of the Program

#include <iostream>
using namespace std;
int main()
{
    int a = 5, b = 10, c = 15;
    int* arr[] = { &a, &b, &c };
    cout << arr[1];
    return 0;
}

// Output: It will print the address of variable b.
            

6. Output of the Program

#include <iostream>
using namespace std;
int main()
{
    char arr[20];
    int i;
    for (i = 0; i < 10; i++)
        *(arr + i) = 65 + i;
    *(arr + i) = 0;
    cout << arr;
    return 0;
}

// Output: ABCDEFGHIJ
            

7. Output of the Program

#include <iostream>
using namespace std;
int main()
{
    char* ptr;
    char str[] = "abcdefg";
    ptr = str;
    ptr += 5;
    cout << ptr;
    return 0;
}

// Output: fg
            




 


.

Recently Updated: New Placement Papers added.
Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Programming & Source Codes | GRE Preparation | Jobs, Discussions | Software Listing | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | International Business Information | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | FAQs | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Excellent Mobiles | Software Testing | Interview Questions | Freshers Jobs | Server Insiders | File Extension Directory

Copyright ©2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved. Read our Privacy Policy