The document contains examples of code snippets from previous CBSE exam papers and their expected outputs. It provides 17 code snippets from exam papers between 2006-2012 with varying levels of complexity. For each snippet, it lists the expected output or describes the approach to partially crediting students' answers. The document serves as a reference for examiners to evaluate responses consistently according to the examples and marking schemes provided.
Java Programming is the most desirable IT training courses in Nepal which is known for reliability, maintainability, and ease of development. Our Java training course comprises a practical method of learning in order to provide a real-time experience. This Java Training course will not only include all the fundamental concepts but also the advanced concepts like Method Overloading & Overriding, Inheritance, Interface, Database connectivity, etc.
1z0 851 exam-java standard edition 6 programmer certified professionalIsabella789
Guaranteed success with updated troytec dumps for 1Z0-851 Exam-Java Standard Edition 6 Programmer Certified Professional visit@ https://www.troytec.com/1Z0-851-exams.html
Java Programming is the most desirable IT training courses in Nepal which is known for reliability, maintainability, and ease of development. Our Java training course comprises a practical method of learning in order to provide a real-time experience. This Java Training course will not only include all the fundamental concepts but also the advanced concepts like Method Overloading & Overriding, Inheritance, Interface, Database connectivity, etc.
1z0 851 exam-java standard edition 6 programmer certified professionalIsabella789
Guaranteed success with updated troytec dumps for 1Z0-851 Exam-Java Standard Edition 6 Programmer Certified Professional visit@ https://www.troytec.com/1Z0-851-exams.html
Hello, I need some assistance in writing a java program THAT MUST US.pdfFashionColZone
Hello, I need some assistance in writing a java program THAT MUST USE STACKS (LIFO).
Create a Calculator w/ GUI
Write a program that graphically displays a working calculator for simple infix expressions that
consist of: single-digit operands, the operators: +, -, *, and /, and parentheses.
Make the following assumptions:
unary operators (e.g. -2) are illegal
all operations, including division, are integer operations (and results are integers)
the input expression contains no embedded spaces and no illegal characters
the input expression is a syntactically correct infix expression
division by zero will not occur (consider how you can remove this restriction)
Create a GUI application, the calculator has a display and a keypad of 20 keys, which are
arranged as follows:
C
<
Q
/
7
8
9
*
4
5
6
-
1
2
3
+
0
(
)
=
As the user presses keys to enter an infix expression, the corresponding characters appear in the
display. The C (Clear) key erases all input entered so far; the < (Backspace) key erases the last
character entered. When the user presses the = key, the expression is evaluated and the result
appended to the right end of the expression in the display window. The user can then press C and
enter another expression. If the user presses the Q (Quit) key, the calculator ceases operation and
is erased from the screen.
C
<
Q
/
7
8
9
*
4
5
6
-
1
2
3
+
0
(
)
=
Solution
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Calculator extends JFrame implements ActionListener {
JPanel[] row = new JPanel[5];
JButton[] button = new JButton[19];
String[] buttonString = {\"7\", \"8\", \"9\", \"+\",
\"4\", \"5\", \"6\", \"-\",
\"1\", \"2\", \"3\", \"*\",
\".\", \"/\", \"C\", \"\",
\"+/-\", \"=\", \"0\"};
int[] dimW = {300,45,100,90};
int[] dimH = {35, 40};
Dimension displayDimension = new Dimension(dimW[0], dimH[0]);
Dimension regularDimension = new Dimension(dimW[1], dimH[1]);
Dimension rColumnDimension = new Dimension(dimW[2], dimH[1]);
Dimension zeroButDimension = new Dimension(dimW[3], dimH[1]);
boolean[] function = new boolean[4];
double[] temporary = {0, 0};
JTextArea display = new JTextArea(1,20);
Font font = new Font(\"Times new Roman\", Font.BOLD, 14);
Calculator() {
super(\"Calculator\");
setDesign();
setSize(380, 250);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
GridLayout grid = new GridLayout(5,5);
setLayout(grid);
for(int i = 0; i < 4; i++)
function[i] = false;
FlowLayout f1 = new FlowLayout(FlowLayout.CENTER);
FlowLayout f2 = new FlowLayout(FlowLayout.CENTER,1,1);
for(int i = 0; i < 5; i++)
row[i] = new JPanel();
row[0].setLayout(f1);
for(int i = 1; i < 5; i++)
row[i].setLayout(f2);
for(int i = 0; i < 19; i++) {
button[i] = new JButton();
button[i].setText(buttonString[i]);
button[i].setFont(font);
button[i].addActionListener(this);
}
display.setFont(font);
display.setEditable(false);
display.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
display.setPreferredSize(displayDimension);
for(int.
Write C++ program that when given a value N(read from cin)- produces a.docxkarlynwih
Write C++ program that when given a value N(read from cin), produces a pictogram of the first N^2 numbers, as follows: for each number, print what is stated below.
Thank you so much!
Solution
#include <iostream>
using namespace std;
int factors[20];
void findFactors(int n)
{
//cout << \"Factors of \" << n << \" are: \" << endl;
int j=0;
for(int i=1;i<=n;++i)
{
if(n%i==0)
{
//cout << i << endl;
factors[j]=i;
j=j+1;
}
}
factors[j]=-1;
}
int isPrime(int no)
{
int i, flag=0;
for(i=2;i<=no/2;++i)
{
if(no%i==0)
{
flag=1;
break;
}
}
if (flag==1)
return 1;
else
return 0;
}
int main()
{
int n,i;
cout << \"Enter a positive integer: \";
cin >> n;
for(int j=1;j<=(n*n);j++)
{
if(j%n==0)
cout<<endl;
if(isPrime(j)==1)
{
cout<<\"P\";
}
else
{ int count=0;
findFactors(j);
int k=0;
while(factors[k]!=-1)
{
if(isPrime(factors[k])==1)
count=count+1;
k=k+1;
}
if(count>=2)
cout<<\'2\';
else
cout<<\'.\';
}
}
return 0;
}
.
simple pattern printing programme in c language for beginners.
here you can see code with its pattern programme and easily can understand the programme.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
2. 1 (e) Find the output of the following program :
Delhi 2006 2
#include<iostream.h>
void main( )
{ long NUM= 1234543;
int F=0, S=0;
do
{ int Rem = NUM% 10 ;
if (Rem % 2 !=0)
F+=R;
else
S+=R;
NUM /=10;
}while(NUM>0);
cout<<F-S;
}
3. Ans:
(e)
2 (assuming R as Rem)
(2 marks for correct output as 2)
OR
(2 marks for identifying error as R is not declared)
OR
(Full 2 marks to be awarded to the students who
have scored at least
1 mark in the entire Q. No. 1 i.e. from 1(a) to 1(f))
4. 2 (e) Find the output of the following program :
OD 2006 2
#include<iostream.h>
void main()
{ long Number = 7583241;
int First=0, Second=0;
do
{ int R = Number%10;
if(R%2==0)
First+=R;
else
Second+=R;
Number /=10;
}while(Number>0);
cout<<First-Second;
}
5. (e) -2
(Full 2 marks for correct output)
OR
(Full 2 marks for mentioning values of First as 14
and Second as 16, as representation of minus
sign is not very prominent)
OR
(Full 2 marks for mentioning syntax error with
justification as insertion operator << expected in
between First and Second)
6. 3 (e) Find the output of the following program :
Delhi 2007 3
#include<iostream.h>
void Indirect(int Temp=20)
{
for (int 1=10; I<=Temp; I+=5)
cout<<I<<” , “ ;
cout<<endl;
}
void Direct (int &Num)
{
Num+=10;
Indirect(Num);
}
7. 3 (e) Find the output of the following program :
Delhi 2007 3
void main()
{
int Number=20;
Direct(Number) ;
Indirect();
cout<< “ Number=” <<Number<<endl ;
}
8. (e)
10, 15, 20, 25, 30,
10, 15, 20,
Number=30
(1 Mark for each correct line of output)
Note:
· ½ Mark to be deducted for missing Commas
(,) in each line of output
· ½ Mark to be deducted if endl is not
considered in the output
9. 4 (e) Find the output of the following program :
OD 2007 3
# include < iostream.h>
void Withdef (int HisNum = 30)
{
for (int 1=20 ; I<*= HisNum; I+=5)
cout<<I<<””;
cout<<endl;
}
void Control (int &MyNum)
{
MyNum+=10;
Withdef(MyNum);
}
10. 4 (e) Find the output of the following program :
OD 2007 3
void main ()
{
int YourNum=20;
Control (YourNum);
Withdef();
cout<<”Number=”<<YourNum<<endl;
}
11. (e)
20,25,30,
20,25,30,
Number=30
(1 Mark for each correct line of output)
Note:
· ½ Mark to be deducted for missing Commas
(,) in the output
· ½ Mark to be deducted if endl is not
considered in the output
12. 5 (e) Find the output of the following program:
Delhi 2008 2
#include<iostream.h>
void main ( )
{
int U = 10, V = 20;
for (int I = 1; 1 < = 2; 1++)
{
cout<<“[1]=”<<U++<<“&”<<V–5<<endl;
cout<<“[2]=”<<++V<<“&”< <U+ 2< <endl;
}
}
13. Ans:
Nnd@*Xrk!*
(½ Mark for N in the 1st position)
(½ Mark for nd in the 2nd and 3rd
position)
(½ Mark for @ in the 4th position)
(½ Mark for * in the 5th position)
(½ Mark for Xrk!)
(½ Mark for * at the end)
OR
(Fu1l 3 Marks If error is mentioned in the
code for Text (I) after last else)
14. 6 (e) Find the output of the following program :
OD 2008 2
#include<iostream.h>
void main ( )
{
int A=5, B=10;
for (int I = 1; I<=2; 1++)
{
cout<< “Linel=”<<A++<<“&”<<B–2<<endl;
cout<<“Line2=”<<++B<<“&”<<A+3<<endl;
}
}
16. 7 (e) Find the output of the following program :
Delhi 2009 2
#include<iostream.h>
#include<ctype.h>
void Encode (char Info [ ], int N) ;
void main ( )
{
char Memo [ ] = “Justnow” ;
Encode(Memo, 2) ;
cout<<Memo<<endl ;
}
17. 7 (e) Find the output of the following program :
Delhi 2009 2
void Encode(char Info[ ], int N)
{
for (int I = 0 ; Info[I] != ‘0’ ; 1++)
if (1%2= =0)
Info[I] = Info[I] –N ;
else if (islower(Info[I]))
Info[I] = toupper(Info[I]) ;
else
Info[I] = Info[I] +N ;
}
18. Ans
HuqTlOu
(½ Mark for writing H, U as the first two
characters)
(½ Mark for writing q, T as the next two
characters)
(½ Mark for writing 1, O as the next two
characters)
(½ Mark for writing u as the last character)
19. 8 (e) Find the output of the following program:
OD 2009 2
#include <iostream.h>
#include <ctype.h>
void Secret (char Mig [ ], int N);
void main ( )
{
char SMS[ ] = “rEPorTmE” ;
Secret{SMS,2);
cout<<SMS<<end1;
}
20. 8 (e) Find the output of the following program:
OD 2009 2
void Secret(char Msg[ ], int N)
{
for (int C=0; Msg[C] ! =’ 0' ;C++)
if (C%2==0)
Msg[C] = Msg[C]+N;
else if (isupper(Msg[C]))
Msg[C] = tolower(Msg[C]);
else
Msg[C] = Msg[C]-N;
}
21. Ans
teRmttoe
(½ Mark for writing t,e as the first two
characters)
(½ Mark for writing R,m as the next two
characters)
(½ Mark for writing t,t as the next two
characters)
(½ Mark for writing o,e as the next two
characters)
22. 9 (e) Find the output of the following program :
Delhi 2010 2
#include <iostream.h>
#include <ctype.h>
void ChangeIt(char Text[ ], char C)
{
for (int K=0;Text[K]!='0';K++)
{
if (Text[K]>=’F’ && Text[K]<=’L’)
Text[K]=tolower(Text[K]);
else
if (Text[K]=’E’ || Text[K]==’e’)
Text[K]= =C;
23. 9 (e) Find the output of the following program :
Delhi 2010 2
else
if (K%2==O)
Text[K]=toupper(Text[K]);
else
Text[K]=Text[K-l];
}
}
24. 9 (e) Find the output of the following program :
Delhi 2010 2
void main ( )
{
char OldText[ ]=”pOwERALone”;
ChangeIt(OldText,’%’);
cout<<“New TEXT:”<<OldText<<endl;
}
25. Ans.
16, 24, 6
6, 34, 16
18, 22, 28
(1 Mark for each line with -correct values)
OR
(½ Mark for any two correct values in each line)
Note:
Deduct (½ Mark if any/all ‘,’ missing
Deduct (½ Mark if endl is not considered at the right
positions
26. 10 (e) Find the output of the following program:
OD 2010 2
#include <iostream.h>
#include <ctype.h>
void MyCode (char Msg [], char CH)
{
for (int (Cnt=O;Msg[Cnt]!=’0';Cnt++)
{
if (Msg[Cnt]>=’B’ && Msg[Cnt]<=’G’)
Msg[Cnt]=tolower(Msg[Cnt]);
else
if (Msg[Cnt]==’A’|| Msg[Cnt]==’a’)
Msg[Cnt]=CH;
27. 10 (e) Find the output of the following program:
OD 2010 2
else
if (Cnt%2==0)
Msg[Cnt]=toupper(Msg[Cnt]);
else
Msg[Cnt]=Msg[Cnt-l];
}
}
void main ()
{
char MyText [] =” ApEACeDriVE”;
MyCode(MyText,’@’);
cout<<“NEW TEXT:”<<MyText<<endl;
}
28. Ans.
NEW TEXT :@@e@ccddIIe
(½ Mark for writing @,@,e as the first three
characters)
(½ Mark for writing @,c,c as the next three
characters)
(½ Mark for writing d,d, I as the next three
characters)
(½ Mark for writing I,e as the next two characters)
Note:
Deduct ½ Mark for not mentioning NEW TEXT:
29. 11 (e) Find the output of the following program:
Delhi 2011 2
#include<iostream.h>
void main ( )
{
int Track [ ] = {10, 20, 30, 40}, *Striker ;
Stxiker=Track :
Track [1] += 30 ;
cout<<"Striker>"<<*Striker<<end1 ;
Striker – =10 ;
Striker++ ;
cout<<"Next@"<<*Striker<<end1 ;
Striker+=2 ;
cout<<"Last@"<<*Striker<<end1 ;
cout<< "Reset To" <<Track[0] <<end1 ;
}
30. Ans
Striker>10
Next@50
Last@40
Reset to 0
(½ for writing each line of output correctly)
Note:
Deduct ½ Mark if any/all special characters are
missing
Deduct ½ Mark if endl is not considered at the
right positions
31. 12 (e) Find the output of the following program:
OD 2011 2
#include<iostream.h>
void main ( )
{
int *Queen, Moves [ ] = {11, 22, 33, 44};
Queen = Moves;
Moves [2] + = 22;
cout<< "Queen @"<<*Queen<<end1;
*Queen - = 11;
Queen + = 2;
cout<< "Now @"<<*Queen<<end1;
Queen++;
cout<< "Finally@"<<*Queen«end1;
cout<< "New Origin @"<<Moves[0]<<end1;
}
32. Ans
Queen @11
Now @55
Finally @44
New origin @0
(½ Mark for writing each line of output
correctly)
Note:
Deduct ½ Mark if any/all '@' missing or/and
endl is not considered at the right positions
33. 13 (e) Find the output of the following
program:
SAMPLE PAPER 2009 SET I 2
#include <iostream.h>
#include <ctype.h>
void Encrypt(char T[])
{
for (int i=0;T[i]!='0';i+=2)
if (T[i]=='A' || T[i]=='E') T[i]='#';
else if (islower(T[i])) T[i]=toupper(T[i]);
else T[i]='@';
}
34. 13 (e) Find the output of the following
program:
SAMPLE PAPER 2009 SET I 2
void main()
{
char Text[]="SaVE EArtH";//The
two words in the string Text
//are separated by single space
Encrypt(Text);
cout<<Text<<endl;
}
35. Answer:
@a@E@E#rTH
(1 Mark for writing all alphabets at
correct positions)
(1/2 Mark for writing @ at correct
positions)
(1/2 Mark for writing # at correct
position)
36. 14 (e) Find the output of the following
program:
SAMPLE PAPER 2009 SET II 2
#include <iostream.h>
struct Game
{
char Magic[20];int Score;
};
void main()
{
Game M={“Tiger”,500};
char *Choice;
37. 14 (e) Find the output of the following
program:
SAMPLE PAPER 2009 SET II 2
Choice=M.Magic;
Choice[4]=’P’;
Choice[2]=’L’;
M.Score+=50;
cout<<M.Magic<<M.Score<<endl;
Game N=M;
N.Magic[0]=’A’;N.Magic[3]=’J’;
N.Score-=120;
cout<<N.Magic<<N.Score<<endl;
}
39. 15 (e) Find the output of the following program:
SAMPLE PAPER 2010 SET I 2
#include <iostream.h>
void Secret(char Str[ ])
{
for (int L=0;Str[L]!='0';L++);
for (int C=0;C<L/2;C++)
if (Str[C]=='A' || Str[C]=='E')
Str[C]='#';
else
{
char Temp=Str[C];
40. 15 (e) Find the output of the following program:
SAMPLE PAPER 2010 SET I 2
Str[C]=Str[L-C-1];
Str[L-C-1]=Temp;
}
}
void main()
{
char Message[ ]="ArabSagar";
Secret(Message);
cout<<Message<<endl;
}
42. 16 (e) Find the output of the following
program:
SAMPLE PAPER 2010 SET II 2
#include <iostream.h>
struct Game
{
char Magic[20];int Score;
};
void main()
{
Game M={"Tiger",500};
char *Choice;
43. 16 (e) Find the output of the following
program:
SAMPLE PAPER 2010 SET II 2
Choice=M.Magic;
Choice[4]='P';
Choice[2]='L';
M.Score+=50;
cout<<M.Magic<<M.Score<<endl;
Game N=M;
N.Magic[0]='A';N.Magic[3]='J';
N.Score-=120;
cout<<N.Magic<<N.Score<<endl;
}