C Language Aptitude Test Paper
#1

[attachment=5628]
‘C’ Language Aptitude Test Paper




Note : All the programs are tested under Turbo C/C++ compilers.
It is assumed that,
 Programs run under DOS environment,
 The underlying machine is an x86 system,
 Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example
sizeof(int) == 2 may be assumed).
Predict the output or error(s) for the following:
1. void main()
{
int const * p=5;
printf("%d",++(*p));
}
Answer:Compiler error: Cannot modify a constant value.
Explanation:
p is a pointer to a "constant integer". But we tried to change the value of the "constant
integer".
2. main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
Answer:
mmmm
aaaa
nnnn
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array
name is the base address for that array. Here s is the base address. i is the index number/displacement from
the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is
same as s[i].
Reply
#2
[attachment=5634]
C++ Programs

#include <iostream.h>
#include <conio.h>

void main()
{
clrscr();
int x = 10;
int y = 2;
int sum, difference, product, quotient;
sum = x + y;
difference = x - y;
product = x * y;
quotient = x / y;
cout << "The sum of " << x << " & " << y << " is " << sum << "." << endl;
cout << "The difference of " << x << " & " << "y << is " << difference << "." << endl;
cout << "The product of " << x << " & " << y << " is " << product << "." << endl;
cout << "The quotient of " << x << " & " << y << " is " << quotient << "." << endl;
getch();
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: what is an aptitude test for a sawmill, aptech aptitude test papers, flow diagram aptitude, schlumberger aptitude test 2014, documentation of aptitude test project, offline aptitude test on visual basic, aptitude test preparation ppt pdf,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  A Paper Presentation on Software Development Automation by Computer Aided Software seminar paper 4 3,127 23-03-2016, 02:05 PM
Last Post: dhanabhagya
  DYNAMIC LANGUAGE seminar addict 2 1,968 03-01-2013, 12:30 PM
Last Post: seminar details
  ELECTRICAL ENGINEERING paper 2 seminar paper 1 1,204 12-10-2012, 12:39 PM
Last Post: seminar details
  An Introduction to the Analytical Writing Section of the GRE® revised General Test computer girl 0 484 11-06-2012, 03:06 PM
Last Post: computer girl
  Paper-Based Augmented Reality seminar details 0 734 09-06-2012, 04:11 PM
Last Post: seminar details
  A New Low Power Test Pattern Generator Using a Variable-Length Ring Counter seminar details 0 1,200 07-06-2012, 04:54 PM
Last Post: seminar details
  Battery Technology Life Verification Test Manual seminar details 0 889 07-06-2012, 12:40 PM
Last Post: seminar details
  C++ Language Tutorial seminar paper 0 2,034 16-03-2012, 12:11 PM
Last Post: seminar paper
  Brief Introduction to the C Programming Language seminar paper 0 985 15-03-2012, 02:14 PM
Last Post: seminar paper
  Solar Cars Hit the Road to Test Route 66 Course seminar paper 0 893 09-03-2012, 02:09 PM
Last Post: seminar paper

Forum Jump: